private Font _Font = new Font("微软雅黑", 12); [Description("字体"), Category("自定义")] publicnew Font Font { get { return _Font; } set { _Font = value; label1.Font = value; } }
private Color _ForeColor = Color.FromArgb(62, 62, 62); [Description("字体颜色"), Category("自定义")] publicnew Color ForeColor { get { return _ForeColor; } set { label1.ForeColor = value; _ForeColor = value; } } privatestring _Text = "单选按钮"; [Description("文本"), Category("自定义")] publicstring TextValue { get { return _Text; } set { label1.Text = value; _Text = value; } } privatebool _checked = false; [Description("是否选中"), Category("自定义")] publicbool Checked { get { return _checked; } set { if (_checked != value) { _checked = value; if (base.Enabled) { if (_checked) { panel1.BackgroundImage = Properties.Resources.radioButton1; } else { panel1.BackgroundImage = Properties.Resources.radioButton0; } } else { if (_checked) { panel1.BackgroundImage = Properties.Resources.radioButton10; } else { panel1.BackgroundImage = Properties.Resources.radioButton00; } } SetCheck(value);
privatevoidUCRadioButton_Load(object sender, EventArgs e) { if (this.Parent != null && this._checked) { foreach (Control c inthis.Parent.Controls) { if (c is UCRadioButton && c != this) { UCRadioButton uc = (UCRadioButton)c; if (_groupName == uc.GroupName && uc.Checked) { Checked = false; return; } } } } }
来看下完整的代码吧
// 版权所有 黄正辉 交流群:568015492 QQ:623128629 // 文件名称:UCRadioButton.cs // 创建日期:2019-08-15 16:03:13 // 功能描述:RadioButton // 项目地址:https://gitee.com/kwwwvagaa/net_winform_custom_control using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms;
private Font _Font = new Font("微软雅黑", 12); [Description("字体"), Category("自定义")] publicnew Font Font { get { return _Font; } set { _Font = value; label1.Font = value; } }
private Color _ForeColor = Color.FromArgb(62, 62, 62); [Description("字体颜色"), Category("自定义")] publicnew Color ForeColor { get { return _ForeColor; } set { label1.ForeColor = value; _ForeColor = value; } } privatestring _Text = "单选按钮"; [Description("文本"), Category("自定义")] publicstring TextValue { get { return _Text; } set { label1.Text = value; _Text = value; } } privatebool _checked = false; [Description("是否选中"), Category("自定义")] publicbool Checked { get { return _checked; } set { if (_checked != value) { _checked = value; if (base.Enabled) { if (_checked) { panel1.BackgroundImage = Properties.Resources.radioButton1; } else { panel1.BackgroundImage = Properties.Resources.radioButton0; } } else { if (_checked) { panel1.BackgroundImage = Properties.Resources.radioButton10; } else { panel1.BackgroundImage = Properties.Resources.radioButton00; } } SetCheck(value);
Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。