Search code examples
.netwinformscontrolbox

Add buttons to a form's control box?


I am looking for a way to add buttons to a form's control box. I don't care in which language it is, but I'd love to have it in .NET (C#, VB.NET or C++).


Yes, I have seen this and none of the solutions in the answer work, at least for Windows 7. And yes, I know this one too, it works, but I am looking for a more natural/native way, if there is.


Solution

  • As Tergiver says in his comment, there's no nice way of doing this, and I'd recommend that in most circumstances it shouldn't be done at all since it'll be really non-standard and confusing to the users.

    However, if you do really need to do it, then I think that the way to do it would be to listen for the WM_NCPAINT message (inside WndProc) and when you get one of those you paint your own button manually. Then you'll have to listen out for mouse events in the area where your button has been drawn and handle those clicks manually also.