2015-06-28 74 views
1

我使用Microsoft Visual Studio Community 2015 RC创建了一个Win32应用程序。我正在使用C++。Win32:为什么我的PRINTDLG(或PRINTDLGEX)有灰色背景?

当我呼叫PrintDlg()PrintDlgEx()时,生成的对话框具有灰色背景。无论如何,我检查过的所有其他程序中的同一个对话框具有白色背景。

我看到有处理WM_CTLCOLORDLG设置对话框的背景颜色的方法,但由于所有其他应用程序具有相同的行为,我不认为它们都是以相同的方式处理此消息。

我这里有我用用PrintDlg()打开对话框代码:

PRINTDLG print_dialog{ 
    sizeof(PRINTDLG), 
    hWnd, 
    NULL, NULL, NULL, 
    0, 
    0, 0, 0, 0, 
    1, 
    NULL, 0, 
    NULL, 
}; 
if (PrintDlg(&print_dialog)) 
{ 
    ... 
} 

和代码为PrintDlgEx()

PRINTDLGEX print_dialog = {}; 
print_dialog.lStructSize = sizeof(PRINTDLGEX); 
print_dialog.hwndOwner = hWnd; 
print_dialog.Flags = PD_NOPAGENUMS; 
print_dialog.nStartPage = START_PAGE_GENERAL; 
if (PrintDlgEx(&print_dialog)) 
{ 
    ... 
} 

什么是错误的,我的应用程序?

非常感谢。

+0

改为使用PrintDlgEx()。 –

+0

@HansPassant我已经尝试过使用'PrintDlgEx()',但我获得了相同的结果。 – brouwer89

+0

请在[PrintDlgEx](https://msdn.microsoft.com/en-us/library/windows/desktop/ms646942.aspx)上显示代码。 – IInspectable

回答

1

可能你的过程不是主题,因为它没有表现出v6 comctl32。非主题对话框默认为按钮颜色的背景。主题对话框有白色背景。

将comctl32 v6清单添加到您的可执行文件。

+0

是的,这解决了我的问题。非常感谢你的帮助! – brouwer89