Answer the question
In order to leave comments, you need to log in
How to put background image in Windows DialogBox?
There is a DialogBox with drop down menus and buttons. The task is to insert a picture into this Dialog window as a background:
Here is a cropped part of the Resouce file
. Any useful tutorials? The search did not help, it leads into a dark forest.
Thank you!
#include <afxres.h>
#include "WindowSettings.h" // for IDC_?, IDD_DLG
// Dialog Box Template for IDD_DLG
//
IDD_DLG DIALOGEX 200, 100, 200, 350
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION DLG_NAME
FONT 8, "MS Sans Serif", 0, 0, 0x0
BEGIN
LTEXT "Display Device", IDC_STATIC, 10, 5, 50, 10
COMBOBOX IDC_DIS, 10, 15, 180, 64, CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Resolution", IDC_STATIC, 10, 35, 50, 10
COMBOBOX IDC_RES, 10, 45, 180, 50, CBS_DROPDOWNLIST | WS_DISABLED | WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "Go", IDC_GO, 40, 205, 50, 15, WS_DISABLED
PUSHBUTTON "Cancel", IDCANCEL, 110, 205, 50, 15
END
Answer the question
In order to leave comments, you need to log in
It is necessary to dig in the direction of processing the WM_ERASEBKGND message. The standard handler fills the background of the window with the BRUSH assigned to this window, in order to replace the background, you need to handle this message yourself in the dialog procedure. And be sure to return TRUE from the handler, otherwise the standard handler will continue to fill the background with the standard color.
If anything - write in a personal, I will help.
Thanks to all! Problem solved! if anyone is interested, I can show the code
Special thanks to Dervish66 for help in solving
I'm not blaming anyone, it's just that you don't need to forget about the Windows User Experience Interaction Guidelines in your applications. That's right, for the future.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question