// Hide Apply and Help buttons CWnd *pWnd = GetDlgItem (ID_APPLY_NOW); pWnd->ShowWindow (FALSE); pWnd = GetDlgItem (IDHELP); pWnd->ShowWindow (FALSE);
CRect rectBtn; int nSpacing = 6; // space between two buttons... for( int i =0; i < sizeof(ids)/sizeof(int); i++) { GetDlgItem (ids [i])->GetWindowRect (rectBtn);
CWnd *pWnd = GetDlgItem (ID_APPLY_NOW);隐藏apply按钮
pWnd = GetDlgItem (IDOK);// 获得确定按钮
pWnd = GetDlgItem (IDCANCEL);//获得取消按钮默认出现上述三个按钮,要放到最右或者进行其它操作可以通过得到的指针进行
m_psh.dwFlags |= PSH_NOAPPLYNOW;
m_psh.dwFlags &= ~PSH_HASHELP;
{
BOOL bResult = CPropertySheet::OnInitDialog(); int ids [] = {IDOK, IDCANCEL};//, ID_APPLY_NOW, IDHELP };
// Hide Apply and Help buttons
CWnd *pWnd = GetDlgItem (ID_APPLY_NOW);
pWnd->ShowWindow (FALSE);
pWnd = GetDlgItem (IDHELP);
pWnd->ShowWindow (FALSE);
CRect rectBtn;
int nSpacing = 6; // space between two buttons... for( int i =0; i < sizeof(ids)/sizeof(int); i++)
{
GetDlgItem (ids [i])->GetWindowRect (rectBtn);
ScreenToClient (&rectBtn);
int btnWidth = rectBtn.Width();
rectBtn.left = rectBtn.left + (btnWidth + nSpacing)* 2;
rectBtn.right = rectBtn.right + (btnWidth + nSpacing)* 2; GetDlgItem (ids [i])->MoveWindow(rectBtn);
}
return bResult;
}
CWnd * pHelpWnd = GetDlgItem(IDHELP);
if( pHelpWnd != NULL )
{
pHelpWnd->ShowWindow(SW_HIDE);
// move the IDCANCEL button to IDHELP button position.
{
CWnd * pWnd1 = GetDlgItem(IDHELP);
CWnd * pWnd2 = GetDlgItem(IDCANCEL);
RECT r1,r2;
pWnd1->GetWindowRect(&r1);
pWnd2->MoveWindow(&r1);
pWnd1->GetClientRect(&r2);
pWnd2->GetWindowRect(&r2);
RECT r3;
int cx, cy;
cy = r2.top - r1.top;
cx = r2.left - r1.left;
r3.top = r1.top - cy;
r3.bottom = r1.bottom - cy;
r3.left = r1.left - cx;
r3.right= r1.right- cx;
pWnd2->MoveWindow(&r3);
}
}
新建一个对话框类,添加一个成员
CMyPropertySheet m_propSheet;(CMyPropertySheet的基类是CPropertySheet ,我想你知道,不多说了)在该类的OnInitDialog中加入如下函数
m_propSheet.Create (this, WS_CHILD| WS_VISIBLE, 0);
m_propSheet.ModifyStyleEx(0,WS_EX_CONTROLPARENT);
m_propSheet.ModifyStyle (0, WS_TABSTOP);
m_propSheet.SetWindowPos(NULL,0,0, 0, 0,
SWP_NOZORDER|SWP_NOSIZE|SWP_NOACTIVATE);
OK.2.TabControl的HotTrack功能只需要打开它在More Style 中选中HotTrack就可以了.3.当然不只是TabControl才有HotTrack功能, 连Scroll Bar都有这功能.4.PropertySheet能够实现,实际上他本身就是使用的TabControl控件, 你只需要知道它有个函数,GetTabCtrl() 返回CTabCtrl *的指针就知道了,不需要提示太多了吧, 连CTabCtrl的指针都知道了, 只是设个属性而已, 又有何难?
非常感谢,一定要给你100分了我还有一贴:
请问,如何使TabCtrl的标签文字居中 100分
http://expert.csdn.net/Expert/topic/1261/1261730.xml?temp=.7761957能不能帮解答一下?不答也请去留言,这里100分不够分