3.代码
C# code
/// <summary> /// C#.Net 设计用户自定义控件 /// </summary> /// </summary>
[ToolboxBitmap(typeof(CustomControl.ucButton), "ucButton.bmp")] public partial class ucButton : UserControl { private bool _IsFocused = false; //标记按钮是否为焦点状态 public ucButton() { InitializeComponent(); this.DoHideFocusedTag(); this.MyCatpionText = this.Name; } private EventHandler _OnButtonClick = null; private string _MyCatpionText = "ucButton1"; /// <summary> /// 按钮标题 /// </summary>
[EditorBrowsable(EditorBrowsableState.Always)] [Browsable(true)]
[DefaultValue("ucButton1")] public string MyCatpionText { get { return _MyCatpionText; } set { _MyCatpionText = value; lblCaption.Text =
_MyCatpionText; } } /// <summary> /// 用户自定义Click事件 /// </summary>
[EditorBrowsable(EditorBrowsableState.Always)] [Browsable(true)] public event EventHandler OnButtonClick { add { _OnButtonClick = new EventHandler(value); } remove { _OnButtonClick -= new
EventHandler(value); } } private void lblCaption_Click(object sender, EventArgs e) { //转移Click事件, 触发用户自定义事件 if
(_OnButtonClick != null) _OnButtonClick(this, e); } private void
lblCaption_MouseDown(object sender, MouseEventArgs e) { if (_IsFocused) { lblCaption.Font = new Font(lblCaption.Font.FontFamily,
lblCaption.Font.Size, FontStyle.Bold); } } private void
lblCaption_MouseUp(object sender, MouseEventArgs e) { if (_IsFocused) { lblCaption.Font = new Font(lblCaption.Font.FontFamily,
lblCaption.Font.Size, FontStyle.Regular); } } private void
ucButton_SizeChanged(object sender, EventArgs e) { lblUnderLine.Top = this.Height - 1; lblUnderLine.Width = this.Width - 15; } /// <summary> /// 还原按钮状态 /// </summary> public void DoHideFocusedTag() { this.pictureBox1.Image =
global::vjsdn.CustomControl.Properties.Resources.GrayTag;
this.lblUnderLine.Visible = false; lblCaption.ForeColor = Color.Black; } /// <summary> /// 设计按钮为焦点状态 /// </summary> public void

DoShowFocusedTag() { this.pictureBox1.Image =
C#.Net用户自定义控件制作教程_计算机软件及应用_IT/计算机_专业资料。C#.Net... ASP.NET教程第三讲 输入... 9页 免费喜欢此文档的还喜欢 WinForm控件开发...
C#制作WinForm控件 C#制作WinForm控件自定义控件基础知识一 、概述 Windows 窗体控件是可再次使用的组件,它们封装了用户界面功能,并且可以用于客户端 Windows 应用程序...
C# 自定义控件制作和使用实例_计算机软件及应用_IT/计算机_专业资料。C# 自... C#制作WinForm用户自定义... 4页 2下载券 第7章 高级控件及自定义... 63...
C#自定义控件制作篇李振军 2004-11-28 该教程适合初学者,例子比较简单,只能起... C#.Net用户自定义控件制... 6页 免费 WinForm控件开发总结 50页 免费 c#自...
C# 自定义控件制作和使用实例 C# C#自定义用户控件 http://www.cnblogs.com/... C#自定义控件的制作 7页 2下载券喜欢此文档的还喜欢 WinForm控件开发总结 50...
(C#)用户自定义控件-圆角Panel代码(WinForm)_IT/计算机_专业资料。(C#)用户... 吃哪些食物不发胖 在家全套瑜伽练习教程81份文档 笑话大全集 笑话大全爆笑版 ...
C#制作WinForm控件_计算机软件及应用_IT/计算机_专业资料。C#制作 WinForm 控件 一 、概述 Windows 窗体控件是可再次使用的组件,它们封装了用户界面功能,并且可以...
c#自定义控件开发实例 自定义控件开发实例最近做一个... WinForm控件开发总结 50页 免费 c#自定义控件开发 ... C#.Net用户自定义控件制... 6页 免费 C#自定义...
C#自定义控件入门教程_IT/计算机_专业资料。平台:VS 2005 WINFORM 语言:C# ...我们在 click 事件中可以经常碰见.EventArgs 是用户传入的参数, 我们这个 Color...
组合框控件是列表框控件和文本框控件的组合,用户可以 键入文本,也可以从所提供... 计算机二级C语言快速教程... 430页 1下载券喜欢此文档的还喜欢 《C# WinForm...
热门文档