Winform控件 - 文本框,自定义,其他?如何添加阻止/删除文本 [英] Winform control - textbox, custom, other? How to add block/remove of text

查看:87
本文介绍了Winform控件 - 文本框,自定义,其他?如何添加阻止/删除文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!



我有一个场景,我发现这是我在winform控制开发方面的知识和经验的一面墙希望其他开发者可以分享他们解决的知识。



我的情景是......



我有一棵树在Windows窗体上查看控件,所有填充和工作正常,没有问题。



我希望用户能够双击或按下添加按钮和树节点被添加到文本框,带下划线和作为文本块。 (双击/按钮已实现且很好)。



单击+删除文本框中的文本块,只会导致删除该块,文本框中的所有其他块都将保持不变。



Treeview,按钮等都很好,它只是这个爆破的文本框(它甚至应该是文本盒子,或者我应该只是添加标签到某个控件并以这种方式处理它。看起来很难看?)



这有点类似于前景,但忘记了解析(当它们从树视图中输入时,会很棒,但不是必需的);它主要是添加/删除文本块。



我用文本框咆哮错误的树吗?



热衷于了解其他开发人员如何处理/ simular这样的情况以及您用来实现它的解决方案。



提前致谢。



(PS。主要是网络开发人员,如果我混淆了一些条款或者我的知识有限,我先生道歉)。



我尝试了什么:



我尝试了什么?



- 在文本框中添加标签,然后使用一些逻辑来处理添加/删除

- 向用户控件添加标签(如上所述,仅使用UC而不是TB)

- 搜索互联网,但winform control like outlook或winform control添加标签到文本框没有显示任何接近可用或甚至关闭的东西,我的foo被打破。

-Praying



添加标签不是问题m,更多的是如何处理交互或删除/添加尽可能最好的方式。

Hi everyone!

I have a bit of a scenario, which I’m finding is a wall of my knowledge and experience in terms of winform control development and hoping other developers may share their knowledge in solving.

My scenario is…

I have a tree view control on a windows form, all populated and working fine, no problems.

I would like the user be the able to double click or pushed an add button and the tree node is added to text box, underlined and as a block of text. (Double click/button is implemented and fine).

Single Click + Delete on the block of text in the text box, would only cause that block to be removed, all other blocks in the textbox would be left alone.

Treeview, buttons, etc. is all fine, it’s just this blasted text box (should it even be a text box, or should I just add labels to some control and handle it that way. seems ugly?)

It is somewhat akin to the outlook to field, but forgetting about the resolving (that would be great, but not needed, as they are being entered from the tree view); it is mainly the adding/deleting to the block of text.

Am I barking up the wrong tree with a textbox?

Keen to hear how other developers have handled a situation like/simular to this and what solutions you have used to implement it.

Thanks in advance.

(PS. mainly a web dev here, if I get some terms mixed up or my knowledge is limited, I apologies upfront).

What I have tried:

What have I tried?

- Added labels to a textbox and then having some logic to handle adding/removal
- Adding labels to a user control (as above, just with a UC not a TB)
- Searching the interwebs, but "winform control like outlook" or "winform control add labels to text" box is not bring up anything close to usable or even close, my foo is broken.
-Praying

Adding the labels isnt the problem, its more so how to handle the interactions or deleting / added in the best way possible.

推荐答案

文本框是错误的方式:如果没有别的,它没有单独文本格式,所以任何下划线都必须应用于整个文本,你根本不能将它应用到它的一部分。

看看RichTextBox而不是 - 那个具有单独的文本格式,因此至少可以为新条目加下划线。
A text box is the wrong way: if nothing else, it has no "individual text" formatting, so any underlining has to apply to the whole text, you can't apply it to a portion of it at all.
Have a look at a RichTextBox instead - that has individual text formatting, so underlining the new entry is at least possible.


这篇关于Winform控件 - 文本框,自定义,其他?如何添加阻止/删除文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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