随笔 - 224  文章 - 41  trackbacks - 0
<2010年3月>
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910

享受编程

常用链接

留言簿(11)

随笔分类(159)

随笔档案(224)

文章分类(2)

文章档案(4)

经典c++博客

搜索

  •  

最新评论

阅读排行榜

评论排行榜

DrawFrameControl 的效果:
RECT rect;
    rect.top = 0;
    rect.left = 0;
    rect.bottom = 40;    
    rect.right = 40;
    pDC->DrawFrameControl(&rect, DFC_CAPTION, DFCS_CAPTIONCLOSE);
    rect.left = 50;
    rect.right = 90;
    pDC->DrawFrameControl(&rect, DFC_CAPTION, DFCS_CAPTIONMIN);
    rect.left = 100;
    rect.right = 140;
    pDC->DrawFrameControl(&rect, DFC_CAPTION, DFCS_CAPTIONMAX);
    rect.left = 150;
    rect.right = 190;
    pDC->DrawFrameControl(&rect, DFC_CAPTION, DFCS_CAPTIONRESTORE);
    rect.left = 200;
    rect.right = 240;
    pDC->DrawFrameControl(&rect, DFC_CAPTION, DFCS_CAPTIONHELP);
 // TODO: Menu bar
    rect.left = 250;   
    rect.right = 290;
    pDC->DrawFrameControl(&rect, DFC_MENU, DFCS_MENUARROW);
    rect.left = 300;
    rect.right = 340;
    pDC->DrawFrameControl(&rect, DFC_MENU, DFCS_MENUCHECK);
    rect.left = 350;
    rect.right = 390;
    pDC->DrawFrameControl(&rect, DFC_MENU, DFCS_MENUBULLET);
    rect.left = 400;
    rect.right = 440;
    pDC->DrawFrameControl(&rect, DFC_MENU, DFCS_MENUARROWRIGHT);
 // TODO: Scroll bar
    rect.top = 50;
    rect.left = 0;
    rect.bottom = 90;    
    rect.right = 40;
    pDC->DrawFrameControl(&rect, DFC_SCROLL, DFCS_SCROLLUP);
    rect.left = 50;
    rect.right = 90;
    pDC->DrawFrameControl(&rect, DFC_SCROLL, DFCS_SCROLLDOWN);
    rect.left = 100;
    rect.right = 140;
    pDC->DrawFrameControl(&rect, DFC_SCROLL, DFCS_SCROLLLEFT);
    rect.left = 150;
    rect.right = 190;
    pDC->DrawFrameControl(&rect, DFC_SCROLL, DFCS_SCROLLRIGHT);
    rect.left = 200;
    rect.right = 240;
    pDC->DrawFrameControl(&rect, DFC_SCROLL, DFCS_SCROLLCOMBOBOX);
    rect.left = 250;
    rect.right = 290;
    pDC->DrawFrameControl(&rect, DFC_SCROLL, DFCS_SCROLLSIZEGRIP);
    rect.left = 300;
    rect.right = 340;
    pDC->DrawFrameControl(&rect, DFC_SCROLL, DFCS_SCROLLSIZEGRIPRIGHT);
 // TODO: Standard button
    rect.top = 100;
    rect.left = 0;
    rect.bottom = 140;    
    rect.right = 40;
    pDC->DrawFrameControl(&rect, DFC_BUTTON, DFCS_BUTTONCHECK);
    rect.left = 50;
    rect.right = 90;
    pDC->DrawFrameControl(&rect, DFC_BUTTON, DFCS_BUTTONRADIOIMAGE);
    rect.left = 100;
    rect.right = 140;
    pDC->DrawFrameControl(&rect, DFC_BUTTON, DFCS_BUTTONRADIOMASK);
    rect.left = 150;
    rect.right = 190;
    pDC->DrawFrameControl(&rect, DFC_BUTTON, DFCS_BUTTONRADIO);
    rect.left = 200;
    rect.right = 240;
    pDC->DrawFrameControl(&rect, DFC_BUTTON, DFCS_BUTTON3STATE);
    rect.left = 250;
    rect.right = 290;
    pDC->DrawFrameControl(&rect, DFC_BUTTON, DFCS_BUTTONPUSH);

使用DrawFrameControl 定制自己的check按钮
void CMyCheckButton::OnPaint()
{
 CPaintDC dc(this); // device context for painting
 CRect rect;
 GetClientRect(&rect);

 CRect BoxRect;
 BoxRect=rect;
 BoxRect.right =BoxRect.left +15;
 dc.DrawFrameControl(BoxRect,DFC_BUTTON,DFCS_BUTTONCHECK|GetCheck()?DFCS_CHECKED :0);

 CFont   myFont; 
 myFont.CreatePointFont (100,_T("宋体"));
 CFont   *pOldFont=(CFont   *)dc.SelectObject(&myFont);
 dc.SetBkMode(TRANSPARENT);  

 CString StrWndText;
 GetWindowText(StrWndText);

 rect.OffsetRect (20,0);
 dc.SetTextColor(RGB(0,0,0));
 dc.DrawText(StrWndText,   rect,   DT_LEFT|DT_VCENTER|DT_SINGLELINE);
 dc.SelectObject   (pOldFont); 
 myFont.DeleteObject   (); 
}

posted on 2010-03-23 10:36 漂漂 阅读(2471) 评论(0)  编辑 收藏 引用 所属分类: 深入vc++

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   博问   Chat2DB   管理