如何隐藏RichTextBox控件的插入符? [英] How can I hide the caret of a RichTextBox control?

查看:74
本文介绍了如何隐藏RichTextBox控件的插入符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

您能否告诉我如何在我的应用运行时完全隐藏RichTextBox控件的插入符?

谢谢。

Hello,

Can you please tell me how can I hide the caret of a RichTextBox control completely while my app is running?

Thanks.

推荐答案

只需传递控件的句柄,API就会隐藏控件内的插入符...

你可以使用dllimport使用此api,然后传递适当的句柄以获得所需的效果。

[DllImport(" user32.dll",EntryPoint =" ShowCaret")]

public static extern long ShowCaret(long hw);

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

public static extern long HideCaret(long hwnd);

现在调用这些方法然后通过控制器的适当手柄使插入符号消失。您必须首先将焦点设置到要为其创建插入符的对象,然后创建插入符号。当你失去焦点时,它会被自动删除/销毁。

希望这有帮助!
Just pass the handle for your control and the API will hide the caret inside the control ...

You can use dllimport to use this api and then pass the appropriate handle to get the desired effect.

[DllImport("user32.dll", EntryPoint="ShowCaret")]
public static extern long ShowCaret(long hwnd);

[DllImport("user32.dll", EntryPoint="HideCaret")]
public static extern long HideCaret(long hwnd);

Now call these methods and then pass the appropriate handle of the control to make the caret dissapear. You must first set focus to the object for which you want to create caret then create caret. when you lost focus, it is automatically deleted/destroyed.

Hope this helps !


这篇关于如何隐藏RichTextBox控件的插入符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆