tags:

views:

21

answers:

1

How to make "what is this?" button like those in top-right corner of dialog boxes. I cant set Form.HelpButton to true because I have Minimize & Maximize buttons there.

+1  A: 

You can't. You either get the min/max buttons OR the help button. These are standard Windows UI guidelines, the help button should only appear on dialogs and dialogs shouldn't have min/max buttons.

You can solve you problem with a wee bit of P/Invoke. Add a What's This button to your UI and implement its Click event like this:

private void btnWhatsThis_Click(object sender, EventArgs e) {
  btnWhatsThis.Capture = false;
  SendMessage(this.Handle, WM_SYSCOMMAND, (IntPtr)SC_CONTEXTHELP, IntPtr.Zero);
}

private const int SC_CONTEXTHELP = 0xf180;
private const int WM_SYSCOMMAND = 0x112;

[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);
Hans Passant
That's it! Thank you!
Poma