.bmp and .ico MFC vc++
-
I wanted to add .ico and .bmp files in the bottom of the dialog right after static text (e.g.like this-> warning :) and help :) )respectively. I'm having difficulty achieving this. I would like to request some guidance with this. Thanks in advance.
-
I wanted to add .ico and .bmp files in the bottom of the dialog right after static text (e.g.like this-> warning :) and help :) )respectively. I'm having difficulty achieving this. I would like to request some guidance with this. Thanks in advance.
Member 14575556 wrote:
I'm having difficulty achieving this.
Which part exactly? Adding an image control to a dialog resource? Reading an image into a
CImage
orCBitmap
object? Rendering that object?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
Member 14575556 wrote:
I'm having difficulty achieving this.
Which part exactly? Adding an image control to a dialog resource? Reading an image into a
CImage
orCBitmap
object? Rendering that object?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
Yes adding icon in any place in the dialog. I wanted to put my custom icon in the left bottom corner of the dialog box. Any guidance will be very helpful thanks.
-
Yes adding icon in any place in the dialog. I wanted to put my custom icon in the left bottom corner of the dialog box. Any guidance will be very helpful thanks.
Can you not just add the control to the dialog resource like you did all of the other controls?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
-
I wanted to add .ico and .bmp files in the bottom of the dialog right after static text (e.g.like this-> warning :) and help :) )respectively. I'm having difficulty achieving this. I would like to request some guidance with this. Thanks in advance.
You just need to add the relevant resource to your dialog. Either by adding a manual resource statement like:
ICON IDI_APPLICATION, IDC_STATIC, 7, 7, 20, 20
, or via the Visual Studio resource editor. Perhaps if you explain clearly what the problem is we may be able to offer further suggestions.
-
Yes adding icon in any place in the dialog. I wanted to put my custom icon in the left bottom corner of the dialog box. Any guidance will be very helpful thanks.
It's called the NON client area but sorry I don't use MFC enough to help. What I can tell you is on the windows API it's the WM_NCPAINT message you need to handle and you simply draw the image onto the Device Context it provides. The WM_NCPAINT message is sent to a window when its frame must be painted. The DC is funny it is the size of the whole frame window with a big hole in the middle you cant draw which is the normal client area. So you can draw from RECT.bottom up whatever the height of the frame is. WM_NCPAINT message - Windows applications | Microsoft Docs[^] You need to handle that however you do in MFC (the code snippett on the link shows how you get the DC on normal Win32 API).
In vino veritas
-
It's called the NON client area but sorry I don't use MFC enough to help. What I can tell you is on the windows API it's the WM_NCPAINT message you need to handle and you simply draw the image onto the Device Context it provides. The WM_NCPAINT message is sent to a window when its frame must be painted. The DC is funny it is the size of the whole frame window with a big hole in the middle you cant draw which is the normal client area. So you can draw from RECT.bottom up whatever the height of the frame is. WM_NCPAINT message - Windows applications | Microsoft Docs[^] You need to handle that however you do in MFC (the code snippett on the link shows how you get the DC on normal Win32 API).
In vino veritas
-
It's called the NON client area but sorry I don't use MFC enough to help. What I can tell you is on the windows API it's the WM_NCPAINT message you need to handle and you simply draw the image onto the Device Context it provides. The WM_NCPAINT message is sent to a window when its frame must be painted. The DC is funny it is the size of the whole frame window with a big hole in the middle you cant draw which is the normal client area. So you can draw from RECT.bottom up whatever the height of the frame is. WM_NCPAINT message - Windows applications | Microsoft Docs[^] You need to handle that however you do in MFC (the code snippett on the link shows how you get the DC on normal Win32 API).
In vino veritas
leon de boer wrote:
It's called the NON client area but sorry I don't use MFC enough to help.
Why is "the left bottom corner of the dialog box" called "NON client area"? :confused:
-
Can you not just add the control to the dialog resource like you did all of the other controls?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
Thank you for the reply. I did that and achieved what I wanted. :)
-
You just need to add the relevant resource to your dialog. Either by adding a manual resource statement like:
ICON IDI_APPLICATION, IDC_STATIC, 7, 7, 20, 20
, or via the Visual Studio resource editor. Perhaps if you explain clearly what the problem is we may be able to offer further suggestions.
Thank you for the reply. After a lot of trial and error and following the guidance. I got what I wanted. :-D
-
leon de boer wrote:
It's called the NON client area but sorry I don't use MFC enough to help.
Why is "the left bottom corner of the dialog box" called "NON client area"? :confused:
Thought he wanted to draw in the frame which is non client .. that belongs to windows (the O/S) not the app (the client). It's so easy to draw in the normal client screen area with MFC didn't think you could mess that up ... Anyhow he worked it out. Moral never over-estimate the question being asked :-)
In vino veritas