代码改变世界

WINFORM隐藏光标

  诺言  阅读(407)  评论(1编辑  收藏  举报
using System.Runtime.InteropServices;
 
[DllImport("USER32", EntryPoint = "HideCaret")]
private static extern bool HideCaret(IntPtr hWnd);
<br>//获得焦点事件时隐藏光标
TB.GotFocus += new EventHandler(TB_GotFocus);
 
void TB_GotFocus(object sender, EventArgs e)
{
    HideCaret((sender as Control).Handle); 
}

  

努力加载评论中...
点击右上角即可分享
微信分享提示