vanco
April 8th, 1999, 11:33 AM
I want put my own button on window tittle bar (beside minimize maximize and close buttons).
Can you help me?
Thanks.
Can you help me?
Thanks.
|
Click to See Complete Forum and Search --> : buttons on window tittle bar vanco April 8th, 1999, 11:33 AM 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 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. Andris Spruds June 30th, 1999, 07:15 AM hi, what do you mean with "remove original bar" ? Dave Lorde June 30th, 1999, 08:15 AM 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 codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |