惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

美团技术团队
D
DataBreaches.Net
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
D
Docker
N
Netflix TechBlog - Medium
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Check Point Blog
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
IT之家
IT之家
月光博客
月光博客
U
Unit 42
K
Kaspersky official blog
T
Threatpost
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
GbyAI
GbyAI
P
Proofpoint News Feed
Last Week in AI
Last Week in AI
云风的 BLOG
云风的 BLOG
酷 壳 – CoolShell
酷 壳 – CoolShell
I
InfoQ
Engineering at Meta
Engineering at Meta
Recorded Future
Recorded Future
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security @ Cisco Blogs
MyScale Blog
MyScale Blog
大猫的无限游戏
大猫的无限游戏
Security Archives - TechRepublic
Security Archives - TechRepublic
Webroot Blog
Webroot Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
S
Schneier on Security
S
Secure Thoughts
The Register - Security
The Register - Security
B
Blog RSS Feed
The Last Watchdog
The Last Watchdog
P
Palo Alto Networks Blog
爱范儿
爱范儿
B
Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News and Events Feed by Topic
阮一峰的网络日志
阮一峰的网络日志
L
LINUX DO - 热门话题
C
Cisco Blogs
Spread Privacy
Spread Privacy
F
Full Disclosure
博客园 - 聂微东
T
The Blog of Author Tim Ferriss

博客园 - Voodoo's天空

时间、事件、实践 投票作弊程序制作思路(续)——突破IP限制投票 投票作弊程序制作思路 C#中使用正则表达式清除javascript脚本的方法 迁移SharePoint Portal Server 2003 (sps2003) 需要注意和出现的问题 一年没有更新自己的BLOG了,主要是记录一些从sqlserver导数据到oracle的解决方法 2004年的最后一个POST 开发自定义控件的笔记(1) 利用ADO中记录集筛选 Smart Client 高级开发 图解Windows历史 非常好的思想 (Design your web pages freely at runtime - by Jasper) 一个PHP版本的数据库操作类,针对MYSQL的 在不同语言中关于CheckBox的处理办法(ASP、JSP、PHP) 一个不完整的OLEDB操作类(自己乱写的,呵呵) Winform的登录窗体设计思路 在应用程序中打开浏览器 周末的中日之战…… 关于值类型和引用类型比较的问题
开发自定义控件的笔记 (2)
Voodoo's天空 · 2004-12-16 · via 博客园 - Voodoo's天空

复合控件...

1、什么是复合控件?
复合控件是由多个控件组成的控件(废话……),有点类似用户控件(*.ascx),但是却是用户自定义控件的。

2、如何做
首先要从 System.Web.UI.WebControls.WebControl 继承外,还有实现INamingContainer接口

public class SelectButton: System.Web.UI.WebControls.WebControl,INamingContainer
{
}


 然后重写CreateChildControls的方法

protected override void CreateChildControls()
{}

在这里里面制作你想要添加的控件即可,比如添加几个按钮
Button but1 = new Button();
but1.Text = 'Button 1';
this.Controls.Add(but1);

Button but2 = new Button();
but2.Text = 'Button 2;
this.Controls.Add(but2);

这样运行之后就是有两个按钮的一个控件了。

这里我有个选择checkbox的控件例子,给大家看一下,由于没有进行设计时的设计,如果运行的话,会是一个空白的点,不过不影响使用, 如果干兴趣的话,可以按照我上一篇《开发自定义控件的笔记(1) 》介绍的方法加上设计时的外观

代码如下:

https://files.cnblogs.com/voodooq/SelectButton.rar 完整代码下载 (嘿嘿,留到最后……)