|
-
April 8th, 1999, 11:33 AM
#1
buttons on window tittle bar
I want put my own button on window tittle bar (beside minimize maximize and close buttons).
Can you help me?
Thanks.
-
April 8th, 1999, 12:14 PM
#2
Re: buttons on window tittle bar
I also have tried this, but the caption bar is only accessible when drawing, not
creating objects. The best Way is to create your own caption & remove the original bar.
-
June 30th, 1999, 07:15 AM
#3
Re: buttons on window tittle bar
hi, what do you mean with "remove original bar" ?
-
June 30th, 1999, 08:15 AM
#4
Re: buttons on window tittle bar
You will need to handle the WM_NCPAINT message (override CWnd::OnNcPaint()), and after calling the default handler, get the window DC (GetWindowDC) draw your button onto the caption area. Use GetSystemMetrics() to work out the size and just where to draw it. The simplest general idea is something like this:
void CChildFrame::OnNcPaint( )
{
CMDIChildWnd::OnNcPaint(); // Do normal frame & caption painting
// calculate button position and size using GetWindowRect and
// GetSystemMetrics to get the window width, border width & height, and
// button sizes
CDC* pDC = GetWindowDC();
// Draw button into DC
}
However, if you want the window caption text to behave correctly when resized to any size and minimised, you really need to draw the whole caption yourself. There's a couple of examples in the 'TitleBar' section of the 'Misc' area on this site.
You will also need to handle the non-client area mouse button clicks OnNcLButtonDown, etc.
Dave
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|