怎么办上下文帮助("这是什么"按钮)在的WinForms? [英] How to do context help ("what is this?" button) in WinForms?
问题描述
如何让这是什么?按钮像那些在对话盒右上角。我不能设置Form.HelpButton为true,因为我已经尽量减少与放大器;最大化按钮那里。
How to make "what is this?" button like those in top-right corner of dialogue boxes. I cant set Form.HelpButton to true because I have Minimize & Maximize buttons there.
推荐答案
您不能。你要么最小/最大按钮或帮助按钮。这些都是标准的Windows用户界面的指引,帮助按钮应该只出现在对话和对话不应该有最小/最大的按钮。
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.
您可以解决你一丁点问题的的P / Invoke。添加这是什么按钮,您的UI和实施这样它的Click事件:
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);
这篇关于怎么办上下文帮助("这是什么"按钮)在的WinForms?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!