I would like to be able to add the help button onto my winform, but keep the maxmimize and minimize buttons, but windows standard is to disable both to be able to show the help button.
There is already a question similar: How to include help '?' in title bar of winform - but in that question the one who asked the question is content with removing those 2 buttons for the help to show.
Is there away that i can have help, max, min and close buttons all there at the same time?
Thanks.
Windows doesn't support showing both. A workaround is to provide your own button to trigger the same action. Put it somewhere close to the upper right corner. You trigger this by sending yourself a WM_SYSCOMMAND message, just like the standard help button does. Like this:
private void Help_Click(object sender, EventArgs e) {
Help.Capture = false;
SendMessage(this.Handle, WM_SYSCOMMAND, (IntPtr)SC_CONTEXTHELP, IntPtr.Zero);
}
private const int WM_SYSCOMMAND = 0x112;
private const int SC_CONTEXTHELP = 0xf180;
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
Which assumes that button's name is "Help".
One way to do this is to draw your own border.
FormBorderStyle = None
Now construct your own caption area. This is non trivial because you have to handle drag resize events, transparency if you want rounded corners, etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With