C#仿QQ皮肤-GroupBox 控件实现(一)
2010-10-06 09:48
543 查看
阅读全文:http://www.sufeinet.com/thread-2104-1-1.html
这一次我们先要研究一下系统的是怎么完成的
我们使用Reflector反编译一下GroupBox一起来看看它的内部是怎么实现的。
从类的开始第一行我们可以看得出来它是继承Control这个类而来的,下面是所有引用的命名空间和继承的源
代码
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Text;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Windows.Forms.Internal;
using System.Windows.Forms.Layout;
using System.Windows.Forms.VisualStyles;
[DefaultEvent("Enter"), Designer("System.Windows.Forms.Design.GroupBoxDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), ClassInterface(ClassInterfaceType.AutoDispatch), DefaultProperty("Text"), ComVisible(true), System.Windows.Forms.SRDescription("DescriptionGroupBox")]
public class GroupBox : Control
{
其实这里告诉我们这样几个问题
1.所有引用的命名空间
2.默认的事件 DefaultEvent("Enter"),
3.在实现设计时服务的类 System.Windows.Forms.Design.GroupBoxDesigner
4.为Com指定接口类型ClassInterface
5.默认的属性DefaultProperty("Text")
6.托管类型或是成员的Com可访问性ComVisible
7.继承自 public class GroupBox : Control
关于事件的注册
我们以一个AutoSizeChanged事件来说明
EditorBrowsable(EditorBrowsableState.Always)
用上面的语句指定属性和方法是否在编辑器里的可见方式 在这里我们合作Always代表是编辑器里是始终可见的
然后让它显示在属性窗口中
阅读全文:http://www.sufeinet.com/thread-2104-1-1.html
这一次我们先要研究一下系统的是怎么完成的
我们使用Reflector反编译一下GroupBox一起来看看它的内部是怎么实现的。
从类的开始第一行我们可以看得出来它是继承Control这个类而来的,下面是所有引用的命名空间和继承的源
代码
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Text;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Windows.Forms.Internal;
using System.Windows.Forms.Layout;
using System.Windows.Forms.VisualStyles;
[DefaultEvent("Enter"), Designer("System.Windows.Forms.Design.GroupBoxDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), ClassInterface(ClassInterfaceType.AutoDispatch), DefaultProperty("Text"), ComVisible(true), System.Windows.Forms.SRDescription("DescriptionGroupBox")]
public class GroupBox : Control
{
其实这里告诉我们这样几个问题
1.所有引用的命名空间
2.默认的事件 DefaultEvent("Enter"),
3.在实现设计时服务的类 System.Windows.Forms.Design.GroupBoxDesigner
4.为Com指定接口类型ClassInterface
5.默认的属性DefaultProperty("Text")
6.托管类型或是成员的Com可访问性ComVisible
7.继承自 public class GroupBox : Control
关于事件的注册
我们以一个AutoSizeChanged事件来说明
EditorBrowsable(EditorBrowsableState.Always)
用上面的语句指定属性和方法是否在编辑器里的可见方式 在这里我们合作Always代表是编辑器里是始终可见的
然后让它显示在属性窗口中
阅读全文:http://www.sufeinet.com/thread-2104-1-1.html
相关文章推荐
- C#仿QQ皮肤-GroupBox 控件实现(一)
- C#仿QQ皮肤-GroupBox 控件实现(一)
- C#仿QQ皮肤----基窗体FormBase与基用户控件FormBase1的实现
- C#仿QQ皮肤----基窗体FormBase与基用户控件FormBase1的实现
- C#仿QQ皮肤----基窗体FormBase与基用户控件FormBase1的实现
- C#仿QQ皮肤-Label与ListBox 控件实现----寻求滚动条的解决方案
- C#仿QQ皮肤-ContextMenuStrip 控件实现
- C#仿QQ皮肤-Label与ListBox 控件实现----寻求滚动条的解决方案
- C#仿QQ皮肤-Button 控件实现
- C#仿QQ皮肤-CustomScrollbar 控件实现
- C#仿QQ皮肤-TabControl控件实现
- C#仿QQ皮肤-TabControl控件实现
- C#仿QQ皮肤-TabControl控件实现
- C#仿QQ皮肤-DateTimePicker 控件实现
- C#仿QQ皮肤-TextBox 控件实现
- C#仿QQ皮肤----基窗体FormBase与基用户控件FormBase1的实现
- C#仿QQ皮肤-常用用户控件EnterFrom1和窗体EntryForm的实现
- C#仿QQ皮肤----基窗体FormBase与基用户控件FormBase1的实现
- C#仿QQ皮肤-TextBox 控件实现
- C# 实现完整的仿QQ截图控件