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

推荐订阅源

V
Vulnerabilities – Threatpost
U
Unit 42
F
Fortinet All Blogs
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
F
Full Disclosure
月光博客
月光博客
Engineering at Meta
Engineering at Meta
博客园_首页
The Register - Security
The Register - Security
G
Google Developers Blog
The Cloudflare Blog
博客园 - Franky
K
Kaspersky official blog
A
Arctic Wolf
Scott Helme
Scott Helme
C
Cisco Blogs
Hugging Face - Blog
Hugging Face - Blog
C
Check Point Blog
NISL@THU
NISL@THU
AI
AI
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
Project Zero
Project Zero
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
Vercel News
Vercel News
T
Tor Project blog
P
Privacy International News Feed
D
Docker
I
Intezer
L
LangChain Blog
P
Proofpoint News Feed
Security Latest
Security Latest
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
博客园 - 聂微东
AWS News Blog
AWS News Blog
Martin Fowler
Martin Fowler
P
Privacy & Cybersecurity Law Blog
V
V2EX
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
The Hacker News
The Hacker News
T
Tenable Blog
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog

博客园 - Voodoo's天空

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

1、从哪个类继承

System.Control
System.Web.WebControls.WebControl

WebControl类是从Control类继承过来的,Control类只有一些基本的功能,而WebControl则有更多的关于控件的描述和修饰。

2、
Render 和 RenderContents方法
重写Render方法,这样可以实现在设计时和运行时显示内容一样的效果
另外,还有一个就是RenderContents方法,两个其实一样,只不过摆放的位置,RenderContents更合理,在html呈现的时候,会把可视化的属性。

3、
添加一个图标到TOOLBAR,方法很简单,就是添加一个BMP的图,将资源设置为包含引用,并且设置大小为16x16的,图标的名字和类名字相同即可。

4、运行时和设计时的操作

在设计时和运行时不同的展示效果
添加一个新的类
Designer.cs
在解决方案中添加一个引用System.Design
引入以下命名空间
System.IO
System.Web.UI;
System.Web.UI.WebControls

并且这个类要从 System.Web.UI.Design.ControlDesigner继承

public Class Designer : System.Web.UI.Design.ControlDesigner
{
    //重写原来的一个方法
 public override string GetDesignTimeHtml()
 {
  //在这里实现在设计时的展现内容
  //默认的情况是返回基类的方法,return base.GetDesignTimeHtml();
  //我们要根据自己的情况进行改写
  //具体的内容请参考MSDN
 }
}

/*
然后我们要在自定义控件的属性(attribute)中添加针对设计时的描述
[Designer("WebControlLibrary1.Designer,WebControlLibrary1"),D.....
*/

待序……

先贴这么多,明天再贴开发复合控件的笔记和一个实例