WEB开发网
开发学院软件开发VC 深入浅出CPropertySheet 阅读

深入浅出CPropertySheet

 2007-10-07 20:23:26 来源:WEB开发网   
核心提示:BOOL CMyPropSheet::OnInitDialog (){ BOOL bResult = CPropertySheet::OnInitDialog(); int ids[] = { IDOK, IDCANCEL, ID_APPLY_NOW }; CRect rectWnd; CRect rectBtn;

BOOL CMyPropSheet::OnInitDialog ()
{
   BOOL bResult = CPropertySheet::OnInitDialog();
  
   int ids[] = { IDOK, IDCANCEL, ID_APPLY_NOW };
  
   CRect rectWnd;
   CRect rectBtn;
  
   GetWindowRect (rectWnd);
   GetDlgItem (IDOK)->GetWindowRect (rectBtn);
  
   int btnWidth = rectBtn.Width();
   int btnHeight = rectBtn.Height();
   int btnOffset = rectWnd.bottom - rectBtn.bottom;
   int btnLeft = rectWnd.right - rectWnd.left;
   rectWnd.bottom = rectBtn.top;
   rectWnd.right = rectWnd.right + btnWidth + btnOffset;
   MoveWindow(rectWnd);
  
   rectBtn.left = btnLeft;
   rectBtn.right = btnLeft + btnWidth;
   for (int i = 0; i < sizeof (ids) / sizeof (int); i++)
   {
     rectBtn.top = (i + 1) * btnOffset + btnHeight * i;
     rectBtn.bottom = rectBtn.top + btnHeight;
     GetDlgItem (ids [i])->MoveWindow (rectBtn);
   }
  
   return bResult;
}

三、改变属性页上的标签文字

首先修改TC_ITEM结构,然后用 SetItem 来修改标签文字,如下代码:

TC_ITEM item;
item.mask = TCIF_TEXT;
item.pszText = "New Label";
//Change the label of the first tab (0 is the index of the first tab)...
GetTabControl ()->SetItem (0, &item);

上一页  1 2 3 4  下一页

Tags:深入浅出 CPropertySheet

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