为什么我们使用 UserControl? [英] Why do we use UserControl?

查看:25
本文介绍了为什么我们使用 UserControl?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经对此进行了一段时间的搜索,但我无法得出结论.什么是用户控件?对我来说,我们可以通过创建新的 Windows 窗体而不是用户控制来做任何事情.我知道有使用的理由,但现在还不清楚.如果有人能阐明其中的奥秘,那就太好了.

ı have been serching this for a while but I couldn't come up with a conclusion. What is UserControl? For me we can do everything with creating new windows forms instead of User Control. I know there is a reason to use but it is not clear right now. If someone illuminates the mystery that would be great.

推荐答案

用户控件基本上是其他现有控件的分组,旨在作为可重用组件(即复合控件).如果您需要将同一组控件放在不同的窗口上,您宁愿将它们分组到一个用户控件中,例如添加数据验证之类的内容,然后在需要时重复使用此控件.

A user control is basically a grouping of other existing control, intended as a reusable component (i.e. composite control). If you need to place the same group of controls on different windows you'd rather group them in a user control, adding things like data validation for instance, and then reuse this control whenever you need it.

这里阅读更多内容.

这篇关于为什么我们使用 UserControl?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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