关于windows api的问题
///<summary>///提供帮助信息的相关操作///</summary>publicclassHelp{#regionAPI[DllImport("user32.d...
/// <summary>
/// 提供帮助信息的相关操作
/// </summary>
public class Help
{
#region API
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
private static extern IntPtr SendMessage(IntPtr hWnd, Int32 Msg, IntPtr wParam, IntPtr lParam);
private const int WM_SYSCOMMAND = 0x112;
private const int SC_CONTEXTHELP = 0xf180;
#endregion
/// <summary>
/// 在指定的控件上显示帮助信息
/// </summary>
/// <param name="hWnd">控件所在窗口地址</param>
/// <param name="C">要显示帮助信息的控件</param>
/// <param name="strHelpInfo">要显示的帮助信息</param>
public static void ShowHelp(IntPtr hWnd,System.Windows.Forms.Control C, string strHelpInfo)
{
System.Windows.Forms.HelpProvider helpProvider1=new System.Windows.Forms.HelpProvider();
helpProvider1.SetHelpString(C, strHelpInfo);//帮助所提示的内容
helpProvider1.SetShowHelp(C, true);//将帮助信息与控件绑定
C.Capture = false;
SendMessage(hWnd, WM_SYSCOMMAND, (IntPtr)SC_CONTEXTHELP, IntPtr.Zero);
}
}
private void button18_Click(object sender, EventArgs e)
{
Help.ShowHelp(this.Handle,(Control)this.textBox1, "tttt");
}
大家帮我看下怎么没有得到效果呢
谢谢 展开
/// 提供帮助信息的相关操作
/// </summary>
public class Help
{
#region API
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
private static extern IntPtr SendMessage(IntPtr hWnd, Int32 Msg, IntPtr wParam, IntPtr lParam);
private const int WM_SYSCOMMAND = 0x112;
private const int SC_CONTEXTHELP = 0xf180;
#endregion
/// <summary>
/// 在指定的控件上显示帮助信息
/// </summary>
/// <param name="hWnd">控件所在窗口地址</param>
/// <param name="C">要显示帮助信息的控件</param>
/// <param name="strHelpInfo">要显示的帮助信息</param>
public static void ShowHelp(IntPtr hWnd,System.Windows.Forms.Control C, string strHelpInfo)
{
System.Windows.Forms.HelpProvider helpProvider1=new System.Windows.Forms.HelpProvider();
helpProvider1.SetHelpString(C, strHelpInfo);//帮助所提示的内容
helpProvider1.SetShowHelp(C, true);//将帮助信息与控件绑定
C.Capture = false;
SendMessage(hWnd, WM_SYSCOMMAND, (IntPtr)SC_CONTEXTHELP, IntPtr.Zero);
}
}
private void button18_Click(object sender, EventArgs e)
{
Help.ShowHelp(this.Handle,(Control)this.textBox1, "tttt");
}
大家帮我看下怎么没有得到效果呢
谢谢 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询