| |

VerySource

 Forgot password?
 Register
Search
View: 729|Reply: 5

How to make the picture control always be displayed at the bottom of the window

[Copy link]

2

Threads

9

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

Post time: 2020-1-20 12:20:01
| Show all posts |Read mode
How to make the picture control always be displayed at the bottom of the window
Reply

Use magic Report

2

Threads

19

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-1-29 22:09:01
| Show all posts
You mean editing resources on the dialog
Can be handled like this (related to the order of drawing controls)
The picture control should be the first object inserted after the dialog resource is inserted,
Then other controls will be added to this picture control

If it is a dynamically created control, it is also related to the creation order, that is, first created first
If you want to display the order of controls in the program,
First use the control object-> Invalidate ();
Reply

Use magic Report

2

Threads

9

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

 Author| Post time: 2020-1-30 10:00:01
| Show all posts
Brother, no way
Let me show you the program
Reply

Use magic Report

0

Threads

6

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-1-30 18:54:01
| Show all posts
Do not use this control, it is difficult to operate, you can write a piece of code in the ONPAINT function of the dialog box

void CXXXXDialog :: OnPaint ()
{
CPaintDC dc (this); // device context for painting
dc.SetBkMode (TRANSPARENT);
CPicture pic;
if (! pic.LoadPicture (background.jpg))
return;
RECT rect;
GetClientRect (&rect);
Ranch
pic.DrawPicture (dc.m_hDC, 0, 0, rect.right-rect.left, rect.bottom-rect.top);
Ranch
}
Reply

Use magic Report

2

Threads

9

Posts

9.00

Credits

Newbie

Rank: 1

Credits
9.00

 China

 Author| Post time: 2020-1-31 12:09:01
| Show all posts
I did it your way, but something went wrong during the reconstruction
E:\VS_soft\C ++\p2p\Server_FileTransfer\Server_FileTransferDlg.cpp (115): error C2065: 'CPicture': undeclared identifier
E:\VS_soft\C ++\p2p\Server_FileTransfer\Server_FileTransferDlg.cpp (115): error C2146: syntax error: missing ';' before identifier 'pic'
E:\VS_soft\C ++\p2p\Server_FileTransfer\Server_FileTransferDlg.cpp (115): error C2065: 'pic': undeclared identifier
E:\VS_soft\C ++\p2p\Server_FileTransfer\Server_FileTransferDlg.cpp (116): error C2228: left of '.LoadPicture' must have class / struct / union type
E:\VS_soft\C ++\p2p\Server_FileTransfer\Server_FileTransferDlg.cpp (116): error C2143: syntax error: missing ')' before '.'
E:\VS_soft\C ++\p2p\Server_FileTransfer\Server_FileTransferDlg.cpp (116): error C2059: syntax error: '/'
E:\VS_soft\C ++\p2p\Server_FileTransfer\Server_FileTransferDlg.cpp (116): error C2059: syntax error: ')'
E:\VS_soft\C ++\p2p\Server_FileTransfer\Server_FileTransferDlg.cpp (117): error C2228: left of '.pic' must have class / struct / union type
E:\VS_soft\C ++\p2p\Server_FileTransfer\Server_FileTransferDlg.cpp (117): error C2228: left of '.DrawPicture' must have class / struct / union type
TCPServer_FT.cpp
Generating Code ...
Error while executing cl.exe
Reply

Use magic Report

0

Threads

6

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

Post time: 2020-4-14 06:30:01
| Show all posts
I forgot to give you this class
Header file PICTURE.H:


// CPicture.h: interface for the CPicture class.
//
////////////////////////////////////////////////// ////////////////////

#if! defined (AFX_PICTURE_H__081D008A_5029_4C56_B80C_37793E323DF6__INCLUDED_)
#define AFX_PICTURE_H__081D008A_5029_4C56_B80C_37793E323DF6__INCLUDED_

#if _MSC_VER> 1000
#pragma once
#endif // _MSC_VER> 1000

////////////////////////////////////////////////// ////////////////////////
#include <stdio.h>

// ------------------------------------------

typedef enum
{
OFM_WRITE = 0,
OFM_READ = 1
} FILE_OPENMODE;

#define HIMETRIC_INCH 2540

// = -----------------------------
class CFileProcess
{
private:
FILE * m_File;

public:
CFileProcess ();
   ~ CFileProcess ();
    BOOL Open (char * FileName, FILE_OPENMODE Open_Mode);
BOOL Write (VOID * zBuffer, DWORD cSize);
    BOOL Read (VOID * zBuffer, DWORD cSize);
LONG GetSize (VOID);
VOID Close (VOID);
};

// ------------------------------------------------ -------------


// -----------------------------------------
class CPicture
{
public:
CPicture ();
virtual ~ CPicture ();
The
private:
IPicture * m_pic;
HGLOBAL hGlobal;

public:

HBITMAP LoadPicture (char * FileName);
HBITMAP LoadPicture (char * FileName, HDC hdc);
VOID FreePicture (VOID);
    HDC _GetDC (VOID);
HBITMAP _GetHandle (VOID);
DWORD _GetWidth (VOID);
DWORD _GetHeight (VOID);
BOOL DrawPicture (HDC hdc, long x, long y, long cx, long cy);
The

};

#endif //! defined (AFX_PICTURE_H__081D008A_5029_4C56_B80C_37793E323DF6__INCLUDED_)
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list