If you have a Form
with MinimizeBox
and MaximizeBox
set to true
, then you can not show Help button on title-bar of Form
and will lose the feature of click on help button to convert it to help cursor to be able to click on controls to show help.
You can make a menu item on MenuStrip
act like standard Help Button. To do so, add a MenuStrip
to the form and add a ToolStripMenuItem
to it, then handle Click
event of the item:
private const int WM_SYSCOMMAND = 0x0112;
private const int SC_CONTEXTHELP = 0xF180;
[System.Runtime.InteropServices.DllImport("user32.dll")]
static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);
private void helpToolStripMenuItem_Click(object sender, EventArgs e)
{
SendMessage(this.Handle, WM_SYSCOMMAND, SC_CONTEXTHELP, 0);
}
Note: If you want to do it using a Button
, you also need to set button1.Capture = false;
before sending the message. But it's not necessary for a ToolStripMenuItem
.
Then when you click on the help menu, the cursor will be changed to ?
cursor and will act like when you click on standard Help button: