Add drop shadow to a child dialog
-
Hi, I want to add drop shadow to a child window... please help me. thank you.
Every new thing you learn,Gives you a new personality.
I will assume you're using MFC:
BOOL CShadowDlg::OnInitDialog()
{
CDialog::OnInitDialog();// Add "About..." menu item to system menu. // IDM\_ABOUTBOX must be in the system command range. ASSERT((IDM\_ABOUTBOX & 0xFFF0) == IDM\_ABOUTBOX); ASSERT(IDM\_ABOUTBOX < 0xF000); CMenu\* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS\_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF\_SEPARATOR); pSysMenu->AppendMenu(MF\_STRING, IDM\_ABOUTBOX, strAboutMenu); } } // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m\_hIcon, TRUE); // Set big icon SetIcon(m\_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here **::SetClassLong( GetSafeHwnd(), GCL\_STYLE, ::GetClassLong(GetSafeHwnd(), GCL\_STYLE) | CS\_DROPSHADOW/\*0x00020000\*/ );** return TRUE; // return TRUE unless you set the focus to a control
}
Note that
CS_DROPSHADOW
requires a Windows version >= XP. Note that after this code is run ALL dialogs will have shadows!Steve
-
I will assume you're using MFC:
BOOL CShadowDlg::OnInitDialog()
{
CDialog::OnInitDialog();// Add "About..." menu item to system menu. // IDM\_ABOUTBOX must be in the system command range. ASSERT((IDM\_ABOUTBOX & 0xFFF0) == IDM\_ABOUTBOX); ASSERT(IDM\_ABOUTBOX < 0xF000); CMenu\* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS\_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF\_SEPARATOR); pSysMenu->AppendMenu(MF\_STRING, IDM\_ABOUTBOX, strAboutMenu); } } // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m\_hIcon, TRUE); // Set big icon SetIcon(m\_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here **::SetClassLong( GetSafeHwnd(), GCL\_STYLE, ::GetClassLong(GetSafeHwnd(), GCL\_STYLE) | CS\_DROPSHADOW/\*0x00020000\*/ );** return TRUE; // return TRUE unless you set the focus to a control
}
Note that
CS_DROPSHADOW
requires a Windows version >= XP. Note that after this code is run ALL dialogs will have shadows!Steve
-
I don't think so. You could always implement this functionality yourself however.
Steve
-
I will assume you're using MFC:
BOOL CShadowDlg::OnInitDialog()
{
CDialog::OnInitDialog();// Add "About..." menu item to system menu. // IDM\_ABOUTBOX must be in the system command range. ASSERT((IDM\_ABOUTBOX & 0xFFF0) == IDM\_ABOUTBOX); ASSERT(IDM\_ABOUTBOX < 0xF000); CMenu\* pSysMenu = GetSystemMenu(FALSE); if (pSysMenu != NULL) { CString strAboutMenu; strAboutMenu.LoadString(IDS\_ABOUTBOX); if (!strAboutMenu.IsEmpty()) { pSysMenu->AppendMenu(MF\_SEPARATOR); pSysMenu->AppendMenu(MF\_STRING, IDM\_ABOUTBOX, strAboutMenu); } } // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m\_hIcon, TRUE); // Set big icon SetIcon(m\_hIcon, FALSE); // Set small icon // TODO: Add extra initialization here **::SetClassLong( GetSafeHwnd(), GCL\_STYLE, ::GetClassLong(GetSafeHwnd(), GCL\_STYLE) | CS\_DROPSHADOW/\*0x00020000\*/ );** return TRUE; // return TRUE unless you set the focus to a control
}
Note that
CS_DROPSHADOW
requires a Windows version >= XP. Note that after this code is run ALL dialogs will have shadows!Steve