我已经接管了使用属性网格的应用程序.有几个文本属性,当我使用左右箭头键时,而不是左右移动文本光标,而是将焦点移到上一个/下一个属性. 我已经尝试处理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文字属性
发布评论