Couldn't resize the title!! It is managed by Windows. If you want to get the XP style caption bar.You could do like this: Don't add WS_CAPTION to your clsss ,and override the CWnd::OnNcCalcSize() to reserve some place for your to draw your title. Where to draw the title? Draw it in the handler of OnNcPaint() . Below is my code on implementing a Owner-draw title bar in the Dialog for your reference only: void CXPStyleDialog::OnNcPaint() { CDC *pDC=GetWindowDC(); CRect rect; GetClientRect(&rect); rect.bottom=rect.top+28; DrawTitleBar(pDC,rect);
?怎样改变SDI标题栏高度?(qfly) 100 6 5-29 13:33 管理
√哪里有表达式计算器的源代码?(qfly) 100 8 5-18 12:27 管理
√如何使得只有合法用户才能下载?(qfly) 100 4 5-15 22:21 管理
√用一个网页如何播放不同的flash?(qfly) 100 6 4-27 03:23 管理
√十分简单的问题(qfly) 100 16 4-21 22:39 管理
√很简单的问题,这个文字特效如何使它循环?(qfly) 100 10 4-4 12:08 管理
√很简单的问题,这个文字特效如何使它循环?(qfly) 100 10 4-4 12:04 管理
√请问哪里有你认为很实用的CGI邮件列表,论坛,记数器代码?(qfly) 100 2 4-2 12:28 管理
√关于win9x下读取硬盘序列号的准确性(qfly) 100 12 3-19 08:58 管理
√软件保护(qfly) 100 10 3-10 13:25 管理
√RSA加密后,得到的注册码太长怎么办??(qfly) 100 11 3-6 13:39 管理
√关于软件加密(200分)(qfly) 100 33 3-4 15:36 管理
√对软件加密感兴趣的来看看,200分(qfly) 100 13 3-3 15:39 管理
√关于禁止CHtmlView的右鍵菜单(qfly) 100 12 2-28 14:57 管理
√88dd(巴迪) 领分(qfly) 100 1 2-28 08:42 管理
√关于网页中的图片(qfly) 100 22 2-27 21:22 管理
√关于网页中的图片(qfly) 100 9 2-27 14:55 管理
If you want to get the XP style caption bar.You could do like this:
Don't add WS_CAPTION to your clsss ,and override the CWnd::OnNcCalcSize()
to reserve some place for your to draw your title.
Where to draw the title?
Draw it in the handler of OnNcPaint() .
Below is my code on implementing a Owner-draw title bar in the Dialog for your
reference only:
void CXPStyleDialog::OnNcPaint()
{
CDC *pDC=GetWindowDC();
CRect rect;
GetClientRect(&rect);
rect.bottom=rect.top+28;
DrawTitleBar(pDC,rect);
rect.DeflateRect(3,4,0,4);
if(m_csIcon.hIcon )
{
DrawIconEx(pDC->m_hDC,rect.left,rect.top,m_csIcon.hIcon,rect.Height(),rect.Height(),0,0,DI_NORMAL);
}
rect.OffsetRect(28,0);
DrawTheText(pDC,rect,m_strTitleText); //Draw the CloseBox
GetClientRect(&rect);
if(m_pBmpClose->m_hObject==NULL)
{
m_pBmpClose=new CBitmap;
m_pBmpClose->LoadBitmap(IDB_BITMAP1);//21*21
}
rect.left=rect.right-21;
rect.OffsetRect(-2,3);
m_rectClose.CopyRect(&rect);
CDC MemDC;
MemDC.CreateCompatibleDC(pDC);
MemDC.SelectObject(m_pBmpClose);
pDC->BitBlt(rect.left,rect.top,21,21,&MemDC,0,0,SRCCOPY); //First we draw the border
CRect temp;
GetClientRect(&temp);
temp.top+=28;
DrawXPBorder(pDC,temp);
}void CXPStyleDialog::OnNcLButtonDown(UINT nHitTest, CPoint point)
{
CDialog::OnNcLButtonDown(nHitTest, point);
ScreenToClient(&point);
GetClientRect(&m_rectClose);
m_rectClose.left=m_rectClose.right-21;
m_rectClose.OffsetRect(-5,2);
if(m_rectClose.PtInRect(point))
{
SendMessage(WM_SYSCOMMAND,SC_CLOSE,MAKELPARAM(0,0));//Send message to close the dialog
return;
}
}BOOL CXPStyleDialog::OnEraseBkgnd(CDC* pDC)
{
return TRUE;
}UINT CXPStyleDialog::OnNcHitTest(CPoint point)
{
CRect rect;
GetClientRect(&rect);
rect.bottom=rect.top+28;
ScreenToClient(&point); if(rect.PtInRect(point))
return HTCAPTION;
else
return CDialog::OnNcHitTest(point);
}