小试,Dialog的应用2007的样式。先看一下图片吧。
是不是和windows原先的不一样呀,呵呵。
代码很简单
1,在stdafx.h头文件中加入bcgcontrol的头文件
#include
<
BCGCBProInc.h
>
2,在应用程序类(App类中)修改
class
CL3App :
public
CWinApp,
public
CBCGPWorkspace
然后在app类的InitInstance方法中,加入
CBCGPVisualManager2007::SetDefaultManager(RUNTIME_CLASS(CBCGPVisualManager2007));//应用2007样式,当然2007有很多种样式,这里我只选择了默认。
3,Dialog单位的修改。
因为,dialog必须要从cbcgpdialog中派生,所以在类定义前这样写。
#define CDialog CBCGPDialog,注意这句只是在头文件中修改了,还得在实现代码中把
CDialog修改为
Code
CL3Dlg::CL3Dlg(CWnd* pParent /*=NULL*/)
: CBCGPDialog(CL3Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CL3Dlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
CL3Dlg::CL3Dlg(CWnd* pParent /*=NULL*/)
: CBCGPDialog(CL3Dlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CL3Dlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
然后在dialog单元的OnInitDialog方法中,加入
CBCGPDialog::EnableVisualManagerStyle(TRUE);
这样,生成的窗体就有2007的样式了。