How to make "what is this?" button like those in top-right corner of dialogu开发者_开发技巧e boxes. I cant set Form.HelpButton to true because I have Minimize & Maximize buttons there.
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);
精彩评论