WEB开发网
开发学院软件开发VC VC++5创建不规则形状窗口 阅读

VC++5创建不规则形状窗口

 2008-11-13 19:32:46 来源:WEB开发网   
核心提示: BOOLCEllipseWndDlg::OnInitDialog(){CDialog::OnInitDialog();//Add"About..."menuitemtosystemmenu.//IDM_ABOUTBOXmustbeinthesystemcommandra

BOOLCEllipseWndDlg::OnInitDialog()
{
CDialog::OnInitDialog();
//Add"About..."menuitemtosystemmenu.
//IDM_ABOUTBOXmustbeinthesystemcommandrange.
ASSERT((IDM_ABOUTBOX&0xFFF0)==IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX<0xF000);
CMenu*pSysMenu=GetSystemMenu(FALSE);
if(pSysMenu!=NULL)
{
CStringstrAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if(!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING,IDM_ABOUTBOX,
strAboutMenu);
}
}
//Settheiconforthisdialog.Theframeworkdoesthisautomatically
//whentheapplication'smainwindowisnotadialog
SetIcon(m_hIcon,TRUE);//Setbigicon
SetIcon(m_hIcon,FALSE);//Setsmallicon
//设置窗口标题为“椭圆窗口”,虽然对话框没有标题条,
//但在任务条的按钮中仍需要标题
SetWindowText(_T("椭圆窗口"));
//取得屏幕宽、高
intcxScreen=::GetSystemMetrics(SM_CXSCREEN);
intcyScreen=::GetSystemMetrics(SM_CYSCREEN);
//设置椭圆X、Y方向的半径
intnEllipseWidth=cxScreen/8;
intnEllipseHeight=cyScreen/8;
//将窗口大小设为宽nEllipseWidth,高nEllipseHeight
//并移至左上角
MoveWindow(0,0,nEllipseWidth,nEllipseHeight);
//创建椭圆区域m_rgnWnd
m_rgnWnd.CreateEllipticRgn(0,0,nEllipseWidth,nEllipseHeight);
//将m_rgnWnd设置为窗口区域
SetWindowRgn((HRGN)m_rgnWnd,TRUE);
returnTRUE;//returnTRUEunlessyousetthefocustoacontrol
}

上一页  1 2 3 4  下一页

Tags:VC 创建 不规则

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接