Why do we use UserControl?(为什么我们使用 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为什么我们使用 UserControl?


基础教程推荐
- 全局 ASAX - 获取服务器名称 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01