您的位置:首页 > 其它

如何去掉TextBox可输入状态时的光标

2008-05-09 20:18 351 查看
c#中不能直接隐藏可编辑控件的光标的功能,真是奇怪!

只能通过WINDOWS API的HideCaret函数来实现

HideCaret函数的申明:


[DllImport("user32", EntryPoint = "HideCaret")]


private static extern bool HideCaret(IntPtr hWnd);

为TextBox添加MouseDown事件:


textbuttons[i].MouseDown += new MouseEventHandler(FrmSend_MouseDown);


void FrmSend_MouseDown(object sender, MouseEventArgs e)




...{


//throw new Exception("The method or operation is not implemented.");


HideCaret(((TextBox)sender).Handle);




}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: