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

    技术2022-05-11  94

    有关属性对话框(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 font m_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


    最新回复(0)