duckblaster
duckblaster

Reputation: 11

Drawing a toolbar on a window's titlebar

How do I draw a toolbar on the titlebar of a C# winforms window in windows vista? I have a window where it works, except when the window is unminimized/unmaximized it increases in size by about 16x32px. If possible, please provide code examples.

Upvotes: 1

Views: 3448

Answers (2)

Xn0vv3r
Xn0vv3r

Reputation: 18184

I've been looking around for the same problem, because I wanted to code a ribbon bar with that big button in the upper left corner... The only good source I found was at CodeProject on this blog and this one and another one.

Upvotes: 0

casperOne
casperOne

Reputation: 74530

The only way to effectively do it is to handle the WM_NCPAINT message when you override the WndProc method for the Form.

Passing to the base implementation of WndProc will cause the windows frame to be painted, but at that point, you would be responsibile for painting your toolbar elements on the title bar.

You will also want to handle all the other WM_NC* messages as well, which will allow you to process button clicks and the like (which you will need to handle events for your painted controls).

Upvotes: 1

Related Questions