0

Possible Duplicate:
Custom titlebars/chrome in a WinForms app

I've been trying to make my own UI, but it wasn't a sucess.


Goal: I would like that my Menu Strip is at the same place as for the ControlBox (Minimize, Maximize and X)

Just like in Flash CS5 and Google Chrome (let's say that tabs becomes menu strips, the ControlBox would be placed the same way), it has this ControlBox in the same row.

Researches: I've seen many post, and I've been searching hours, only to find a post in this website and the guy's answer was "Try put FormBorderStyle to None and make your own UI".

Problem is, making the ControlBox of Windows isn't easy at all and I would like to have the UI of windows (Borders arround the page)...


Any help is appreciated! :)

Community
  • 1
  • 1
Martin
  • 23
  • 3

1 Answers1

2

Here's a similar question: Custom titlebars/chrome in a WinForms app. The answers there should help you get started.

That question doesn't specifically ask about the control box, but one of the answers links to a set of articles called "Drawing Custom Borders in Windows Forms", and the first article in that series shows how to override WM_NCHITTEST. If you check the mouse coordinates passed to WM_NCHITTEST, and return the correct code when the coordinates are where you want your control box to be, then Windows will show the system menu when the user clicks there. I think you probably want to return HTSYSMENU, but if that doesn't work, just override WM_NCHITTEST on a normal window, call the inherited handler, and then see which code it returns.

Community
  • 1
  • 1
Joe White
  • 94,807
  • 60
  • 220
  • 330
  • Someone Mentionned Krypton Suite in the post, I am currently looking to see how it works! Thank you for your quick response :) – Martin Jul 21 '11 at 14:43
  • Finally I decided to leave it like this, since the user uses WinXP and there may be comptability issue. Thanks anyway :D – Martin Jul 23 '11 at 06:25