将光标隐藏在富文本框中 [英] Hiding cursor in rich text box

查看:52
本文介绍了将光标隐藏在富文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我试图将光标隐藏在我的富文本框中.以下是我执行的操作:

Hello All,

I am trying to hide the cursor in my rich text box. The following is what I have carried out:

<dllimport("user32")> _
    Private Shared Function HideCaret(ByVal hwnd As IntPtr) As Integer

    End Function

 Private Sub rtbReport_GotFocus(sender As Object, e As System.EventArgs) Handles rtbReport.GotFocus
        HideCaret(rtbReport.Handle)
    End Sub


但是,恐怕上述方法不起作用.

任何想法将不胜感激.

添加了[edit]代码标签[/edit]


But I am afraid the above does not work.

Any ideas would greatly be appreciated it.

[edit] code tags added [/edit]

推荐答案

很抱歉,如果我的建议不能解决问题,但是您可以想到一个非常好的选择使用RichTextBox. CodeProject上有几个非常好的组件,它们提供了HTML呈现.请参阅:

对于表格:
您将使用的专业HTML渲染器 [ ^ ].

对于WPF:
WPF HTML支持的TextBlock [
I''m sorry if my advice does not address the problem, but you could think of a very good alternative to using RichTextBox. There are a couple of very good components on CodeProject offering rendering of HTML instead. Please see:

For Forms:
A Professional HTML Renderer You Will Use[^].

For WPF:
WPF HTML Supported TextBlock[^].

—SA


恐怕通过实现以下内容不会隐藏富文本框控件的插入符号:

< dllimport("user32")> _
私有共享函数HideCaret(ByVal hwnd As IntPtr)As Integer

最终功能

‘您的富文本框= rtbReport
私人Sub rtbReport_GotFocus(发送者为对象,e为System.EventArgs)处理rtbReport.GotFocus
HideCaret(rtbReport.Handle)
结束子

解决方案:
最终对我有用的方法是调用
rtbReport.TabStop = False在表单加载事件中.
I am afraid by implementing the following does not hide the rich text box control caret:

<dllimport("user32")> _
Private Shared Function HideCaret(ByVal hwnd As IntPtr) As Integer

End Function

‘Your rich text box=rtbReport
Private Sub rtbReport_GotFocus(sender As Object, e As System.EventArgs) Handles rtbReport.GotFocus
HideCaret(rtbReport.Handle)
End Sub

Solution:
The method which eventually worked for me is to call
rtbReport.TabStop = False Within the form load event.


这篇关于将光标隐藏在富文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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