PropertyGrid文字属性

编程入门 行业动态 更新时间:2024-10-25 22:34:29
本文介绍了PropertyGrid文字属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经接管了使用属性网格的应用程序.有几个文本属性,当我使用左右箭头键时,而不是左右移动文本光标,而是将焦点移到上一个/下一个属性. 我已经尝试处理KeyPress,KeyDown等事件,但是显然这些不是由Microsoft实现的.更准确地说,PropertyGrids内部网格中的关键事件没有公开公开. 我也尝试过创建internal class TextEditor : UITypeEditor以便提供自己的文本框,但是我不确定如何使它起作用.特别是UITypeEditorStyle枚举具有三个值,这些值似乎都不适合于网格内TextBox.有很多使用下拉列表和弹出表单执行此操作的示例,但没有网格内文本框. 我真正想要的是允许用户在属性网格"文本属性中左右移动光标. 任何人有任何建议吗?

I have taken over an application which uses the property grid. There are a couple of text properties which when I use the left and right arrow keys, instead of moving the text cursor left and right, moves focus to the previous / next property. I have tried handling the KeyPress, KeyDown etc events but apparently these aren''t implemented by microsoft. More accurately the key events from the PropertyGrids internal grid are not exposed publicly. I have also tried creating an internal class TextEditor : UITypeEditor in order to provide my own text box but I am unsure how to get this to work. In particular the UITypeEditorStyle enum has three values none of which seem appropriate for an in-grid TextBox. There are lots of examples of doing this with dropdown lists and popup forms but not in-grid Textboxes. All I really want is to allow the users to move the cursor left and right in the Property Grid text properties. Anyone have any suggestions?

推荐答案

您好,我没有您的问题的详细信息,但在诸如此类的keydown事件中将此方法用于texteditor: Hi, I haven''t details about your problem but use this method for texteditor in keydown events like this: if(e.KeyCode == Keys.Right) this.SelectNextControl(Txt_Price, true, true, true, true);

对于customcontrol,请使用ParentForm进行以下操作:

For customcontrol use ParentForm for this:

if(e.KeyCode == Keys.Right) ParentForm.SelectNextControl(object, true, true, true, true);

不要忘记对tabstop属性进行排序. :thumbsup: 波斯男孩 :rose:

Don''t forget to sort tabstop property. :thumbsup: Persian boy :rose:

更多推荐

PropertyGrid文字属性

本文发布于:2023-11-12 12:50:03,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1581539.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:属性   文字   PropertyGrid

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!