选择什么:自定义控件还是用户控件?

编程入门 行业动态 更新时间:2024-10-26 19:25:34
本文介绍了选择什么:自定义控件还是用户控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我需要创建一个由DatePicker和Label组成的控件.Label会告诉我们DatePicker中的星期几.该控件应该具有属性LabelVisibility(类似的东西),以便可以禁用它.它还应该能够实现样式并具有标准的控制行为.

I need to create a control which will consist of DatePicker and Label.The Label will tell us what day is pressed in DatePicker. This control should have a property LabelVisibility(something like that) to give possibility to disable it. Also it should be able to implement styles and have standart control behavior.

推荐答案

我认为您没有太多选择.您需要创建一个从用户控件继承的自定义控件.自己的用户控件没有多大用处. 可以直接从马的嘴里说: UserControl类MSDN [ ^ ] Provides an empty control that can be used to create other controls. I don''t think you have much choice. You need to create a Custom Control inheriting from User Control. A user control on it''s own is not much use. Here it is directly from the Horses mouth so to speak: UserControl Class MSDN[^] Provides an empty control that can be used to create other controls.

您要描述的是UserControl.

更多推荐

选择什么:自定义控件还是用户控件?

本文发布于:2023-11-11 17:51:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1579145.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控件   自定义   用户

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!