深入浅出CPropertySheet
2007-10-07 20:23:26 来源:WEB开发网核心提示:四、改变属性页标签文字的字体属性代码如下m_NewFont.CreateFont (14, 0, 0, 0, 800, TRUE, 0, 0, 1, 0, 0, 0, 0, _T("Arial") ); GetTabControl()->SetFont (&m_NewFont);五、在属性页标
四、改变属性页标签文字的字体属性
代码如下
m_NewFont.CreateFont (14, 0, 0, 0, 800, TRUE, 0, 0, 1, 0, 0, 0, 0, _T("Arial") );
GetTabControl()->SetFont (&m_NewFont);
五、在属性页标签上显示位图
可以用 CImageList 建立图像. 用 SetItem 来设置,如下代码所示:
BOOL CMyPropSheet::OnInitDialog ()
{
BOOL bResult = CPropertySheet::OnInitDialog();
m_imageList.Create (IDB_MYIMAGES, 13, 1, RGB(255,255,255));
CTabCtrl *pTabCtrl = GetTabControl ();
pTabCtrl->SetImageList (&m_imageList);
TC_ITEM item;
item.mask = TCIF_IMAGE;
for (int i = 0; i < NUMBER_OF_TABS; i++)
{
item.iImage = i;
pTabCtrl->SetItem (i, &item );
}
return bResult;
}
六、在属性页左下角显示位图
如下代码所示:
void CMyPropSheet::OnPaint ()
{
CPaintDC dc(this); // device context for painting
int nOffset = 6;
// load IDB_BITMAP1 from our resources
CBitmap bmp;
if (bmp.LoadBitmap (IDB_BITMAP1))
{
// Get the size of the bitmap
BITMAP bmpInfo;
bmp.GetBitmap (&bmpInfo);
// Create an in-memory DC compatible with the
// display DC we''re using to paint
CDC dcMemory;
dcMemory.CreateCompatibleDC (&dc);
// Select the bitmap into the in-memory DC
CBitmap* pOldBitmap = dcMemory.SelectObject (&bmp);
// Find a bottom-left point for the bitmap in the client area
CRect rect;
GetClientRect (&rect);
int nX = rect.left + nOffset;
int nY = rect.top + (rect.Height () - bmpInfo.bmHeight) - nOffset;
// Copy the bits from the in-memory DC into the on-
// screen DC to actually do the painting. Use the centerpoint
// we computed for the target offset.
dc.BitBlt (nX, nY, bmpInfo.bmWidth, bmpInfo.bmHeight, &dcMemory,
0, 0, SRCCOPY);
dcMemory.SelectObject (pOldBitmap);
}
// Do not call CPropertySheet::OnPaint() for painting messages
}
Tags:深入浅出 CPropertySheet
编辑录入:爽爽 [复制链接] [打 印]- ››深入浅出实战攻防恶意PDF文档
- ››深入浅出ShellExecute
- ››深入浅出URL编码
- ››深入浅出Java多线程程序设计
- ››深入浅出 jackrabbit 八 索引合并(上)
- ››深入浅出 jackrabbit 九 索引合并(下)
- ››深入浅出 jackrabbit 十 redolog 和 recovery.doc...
- ››深入浅出 jackrabbit 十一 jackrabbit改进要点
- ››深入浅出 jackrabbit 十二 key-value存储系统
- ››深入浅出 jackrabbit 十三 查询之AST和QT
- ››深入浅出 jackrabbit 一
- ››深入浅出 jackrabbit 二 索引概览
更多精彩
赞助商链接