有关属性对话框(property sheet )的几个提示

来源:互联网 发布:恺英网络阿拉德之怒 编辑:程序博客网 时间:2024/05/23 12:01

有关属性对话框(property sheet )的几个提示

闻怡洋

下面的所有例子,都假定你从CPropertySheet中派生了新类。

1、隐藏APPLY按钮

使用 PSH_NOAPPLYNOW 标志.

propsheet.m_psh.dwFlags |= PSH_NOAPPLYNOW;
2、增加新的子窗口
使用成员变量。CEdit m_edit.BOOL CMyPropSheet::OnInitDialog(){BOOL bResult = CPropertySheet::OnInitDialog();CRect rectWnd;GetWindowRect(rectWnd);SetWindowPos(NULL, 0, 0,rectWnd.Width() + 100,rectWnd.Height(),SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE);m_edit.CreateEx( WS_EX_CLIENTEDGE, _T("EDIT"), NULL,WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER, rectWnd.Width(), 20, 80, 24, m_hWnd, 0, 0 );m_edit.SetFont( GetFont() );CenterWindow();return bResult;}
3、改变页片上的字体

在 OnInitDialog() 中:

// m_fontEdit is a member variable// Create a bold fontm_fontEdit.CreateFont( -8, 0, 0, 0, 700, 0, 0, 0, 1, 0, 0, 0, 0, _T("MS Sans Serif") );GetTabControl()->SetFont( &m_fontEdit );

4、使用Image

m_imageTab为成员变量。
BOOL CMyPropSheet::OnInitDialog()
{
BOOL bResult = CPropertySheet::OnInitDialog();

m_imageTab.Create( IDB_TABIMAGES, 13, 1, RGB(255,255,255) );
CTabCtrl *pTab = GetTabControl();
pTab->SetImageList( &m_imageTab );

TC_ITEM tcItem;
tcItem.mask = TCIF_IMAGE;
for( int i = 0; i < 3; i++ )
{
tcItem.iImage = i;
pTab->SetItem( i, &tcItem );
}
return bResult;
}

 


摘自玉海园 http://www.mfc2000.yeah.net



Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=9076

 
原创粉丝点击