标签和Richtextbox [英] Labels and Richtextbox

查看:61
本文介绍了标签和Richtextbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以在RichTextBox中使用Label控件吗,该怎么做?我想将文本放置在距边框一定距离的地方,但找不到任何代码可以做到这一点.

Can I use a Label control in a RichTextBox and how do I do it? I want to position the text a certain distance from the border and I can''t find any code to do that.

推荐答案

尽管您可以向其中添加标签控件RichTextBox,它的用途不是很多-它位于用户尝试添加的任何文本的前面,并隐藏了光标,因此对用户来说不明显是怎么回事.
仍然:
While you can add a label control to a RichTextBox, it isn''t really a whole lot of use - it sits in front of any text the user is trying to add, and hides the cursor so it isn''t obvious to the user what is going on.
Still:
Label l = new Label();
l.Text = "MINE!";
myRichTextBox.Controls.Add(l);

将起作用!

您想做什么以为您认为这是个好主意?

Will work!

What are you trying to do that you think this is a good idea?


不是Windows窗体.您可以将其标记为只读.
Not in Windows forms. You can mark it as readonly though.


这篇关于标签和Richtextbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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