用户控制属性&事件 [英] Usercontrol property & events

查看:61
本文介绍了用户控制属性&事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好



我有一个UserControl,由几个控件组成。但是如何在我编译的UserControl中拥有每个控件的所有属性和事件,其中最终用户可以在设计其形式时访问所有控件属性和事件。我应该为所有人定义属性和事件还是这些很简单?



谢谢



我尝试了什么:



创建属性和事件,但耗时

hello

I have a UserControl which is made of several controls. but how can I have all "Properties" and "Events" of each control in my compiled UserControl in which the end user be able to have access to all control properties and events when designig its form. should I define property and Event for all of them or these is easy way?

thank you

What I have tried:

Create Property and Event, But it is time consuming

推荐答案

当然......它需要时间......



首先你应该定义,子控件中的哪些属性是UserControl所必需的。同样的事件。

通常你不需要所有子控件的所有属性 - 例如BackColor:我假设大多数子控件都有相同的BackColor。因此,您可以将此值从一个属性分配给所有相关的子控件。



也许有几种方法可以使某些部件更容易。但为此你应该更具体。也许你用更多细节来改善你的问题......
Of course ... it needs time ...

At first you should define, which Properties from the Sub-Controls are necessary for the UserControl. Same for the Events.
Normally you don't need all Properties from all Sub-Controls - for Example BackColor : I assume that most of the Sub-Controls have the same BackColor. So you could assign this value from one Property to all related Sub-Controls.

Perhaps there are severall ways to make some parts easier. But for this you should be more specific. Perhaps you improve your question with more Details ...


这篇关于用户控制属性&事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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