关于在标题栏画按钮的问题。
jimw 2001-07-18 08:27:56 我在一个单文档工程中的标题栏上画按钮。但只在改变大小窗口后按钮才能显示出来,这是为什么?怎么才能使它在程序启动时就显示呢?
void CMainFrame::OnNcPaint()
{
// TODO: Add your message handler code here
Default();
// To accesses the entire screen area of a CWnd
// (both client and nonclient areas).
CDC* pDC = GetWindowDC();
CSize sizeFrame(GetSystemMetrics(SM_CXFRAME),
GetSystemMetrics(SM_CYFRAME));
CSize sizeBorder(GetSystemMetrics(SM_CXBORDER),
GetSystemMetrics(SM_CYBORDER));
CSize sizeButton(GetSystemMetrics(SM_CXSIZE),
GetSystemMetrics(SM_CYSIZE));
CRect rcWindow;
GetWindowRect(rcWindow);
CRect rc;
rc.top = sizeFrame.cy;
rc.right = rcWindow.Width() - sizeFrame.cx - 3*sizeBorder.cx - 3*sizeButton.cx;
rc.left = rc.right - 100;
rc.bottom = sizeButton.cy + 3;
pDC->DrawFrameControl(rc,
DFC_BUTTON,
DFCS_BUTTONPUSH );
// Do not call CFrameWnd::OnNcPaint() for painting messages
}