第一次在设计器中设置相关属性的问题
我开发了一个表单设计器,还开发了一些继承自标准控件(如按钮)的自定义控件。
另外,我有一些相关的属性,例如用户必须首先选择部门,然后选择人员。在用户选择人员后,我设置自定义控件的文本(在本例中继承自按钮)。
注意:用户可以更改 Text 属性。
一切工作正常,但是当我从数据库加载或拖放控件到表单设计器时,controlName# 设置的文本,
覆盖文本属性并调试它后,我看到文本设置正确,但在设置我的文本后,设计器设置文本controlName#表示这个错误。
如何解决这个问题?
提前致谢
哈米德
I Develop a Form Designer, also develop some custom control that inherit from standard control like button.
Also, i have some property that related, for example user must select department first, and then select person. and after user select person, I set Text of my custom control (that inherit from button in this case).
Note: user can change Text property.
All thing work properly, but when i load from DB or drag and drop control to form designer, Text of controlName# set,
After override Text property and debug it, i see text set right, but after set my text, designer set text with controlName# that this wrong.
How to solve this proplem ?
Thanks in advance
Hamid
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以将一些属性应用于您的属性,例如
ReadOnly
,这也将阻止设计者设置您的属性。我目前找不到链接,但还有一种方法可以告诉表单设计器应该按特定顺序设置属性。
编辑:
好吧,不太像我记忆中的那样,但我认为类似于ISupportInitialize 接口。
像这样:
这样,您的所有检查都可以被禁用,直到您的对象完全初始化为止。
There are attributes you can apply to your properties such as
ReadOnly
that will stop the designer from setting your property too.I cant find the link at the moment, but there is also a method of telling the forms designer that it should set properties in a certain order.
Edit:
Ok, not quite what i remembered it as, but i think something like the ISupportInitialize interface.
Something like:
This way all your checking can be disabled until your object is fully initialised.
您可以检查覆盖的
Text
设置器是否已设置为controlName#
,如果是,则不执行任何操作。You could check in your overriden
Text
setter whether it's being set tocontrolName#
and, if it is, do nothing.