public partial class UCCheck : UserControl
{
[Browsable(true), Category("修改属性"), Description("控件标识,用来判断同类型的不同对象")]
public string Identification { get; set; }
private bool isStatus = false;
/// <summary>
/// 关门状态,true选中,false关
/// </summary> [Browsable(true), Category("修改属性"), Description("是否选择,true选中")]
public bool IsStatus
{
get { return isStatus; }
set { isStatus = value;
pbxMove.Image = isStatus?Properties.Resources.check_box: Properties.Resources.check_def;
//Image.FromFile(isStatus ? @"img\check_box.png" : @"img\check_def.png");
}
}
/// <summary>
/// 关门状态,true开,false关
/// </summary> [Browsable(true), Category("修改属性"), Description("显示文字")]
public string ShowTxt
{
get { return label2.Text; }
set
{
label2.Text = value;
}
}
public delegate void CheckHandle(object sender, EventArgs e);
[Browsable(true), Category("子控件的事件"), Description("勾选事件")]
public event CheckHandle CheckClicked; public UCCheck()
{
InitializeComponent();
} private void pbxMove_Click(object sender, EventArgs e)
{
IsStatus = !IsStatus;
CheckClicked?.Invoke(this, e);
}
}
namespace LUserControl
{
partial class UCCheck
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null; /// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
} #region 组件设计器生成的代码 /// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label2 = new System.Windows.Forms.Label();
this.pbxMove = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pbxMove)).BeginInit();
this.SuspendLayout();
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)()));
this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)()))), ((int)(((byte)()))), ((int)(((byte)()))));
this.label2.Location = new System.Drawing.Point(, );
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(, );
this.label2.TabIndex = ;
this.label2.Text = "本柜";
//
// pbxMove
//
this.pbxMove.BackColor = System.Drawing.Color.Transparent;
this.pbxMove.BackgroundImage = global::LUserControl.Properties.Resources.check_def;
this.pbxMove.Dock = System.Windows.Forms.DockStyle.Left;
this.pbxMove.Location = new System.Drawing.Point(, );
this.pbxMove.Name = "pbxMove";
this.pbxMove.Size = new System.Drawing.Size(, );
this.pbxMove.TabIndex = ;
this.pbxMove.TabStop = false;
this.pbxMove.Click += new System.EventHandler(this.pbxMove_Click);
//
// UCCheck
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.pbxMove);
this.Controls.Add(this.label2);
this.Name = "UCCheck";
this.Size = new System.Drawing.Size(, );
((System.ComponentModel.ISupportInitialize)(this.pbxMove)).EndInit();
this.ResumeLayout(false);
this.PerformLayout(); } #endregion private System.Windows.Forms.Label label2;
private System.Windows.Forms.PictureBox pbxMove;
}
}

winform 勾选可以改变框控件的更多相关文章

  1. layui 多选下拉框 控件 样式改变原因

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  2. Java通过复选框控件数组实现添加多个复选框控件

    编写程序,通过复选框控件数组事先选择用户爱好信息的复选框,在该程序中,要求界面中的复选框数量可以根据指定复选框名称的字符串数组的长度来自动调节. 思路如下: 创建JPanel面板对象: 使用JPane ...

  3. CheckBox复选框控件

    CheckBox复选框控件 一.简介 1. 2.类结构图 二.CheckBox复选框控件使用方法 这里是使用java代码在LinearLayout里面添加控件 1.新建LinearLayout布局 2 ...

  4. css input checkbox复选框控件 样式美化的多种方案

    checkbox复选框可能是网站中常用的html元素,但大多数人并不满意它的默认样式,这篇文章就讲讲如何实现input checkbox复选框控件 样式美化效果. 资源网站大全 https://55w ...

  5. [WinForm]WinForm跨线程UI操作常用控件类大全

    前言 在C#开发的WinForm窗体程序开发的时候,经常会使用多线程处理一些比较耗时之类的操作.不过会有一个问题:就是涉及到跨线程操作UI元素. 相信才开始接触的人一定会遇上这个问题. 为了解决这个问 ...

  6. MFC编程入门之二十四(常用控件:列表框控件ListBox)

    前面两节讲了比较常用的按钮控件,并通过按钮控件实例说明了具体用法.本文要讲的是列表框控件(ListBox)及其使用实例. 列表框控件简介 列表框给出了一个选项清单,允许用户从中进行单项或多项选择,被选 ...

  7. 通过winForm控制webForm的上传控件file的值

    文件上传是日常开发中经常遇到的,文件上传用的最多的当然是上传控件file了,一个form表单,其中有一点就是form表单的enctype属性设置为multipart/form-data,呵呵,这个在所 ...

  8. VS2010/MFC编程入门之二十四(常用控件:列表框控件ListBox)

    前面两节讲了比较常用的按钮控件,并通过按钮控件实例说明了具体用法.本文要讲的是列表框控件(ListBox)及其使用实例. 列表框控件简介 列表框给出了一个选项清单,允许用户从中进行单项或多项选择,被选 ...

  9. DevExpress的下拉框控件ComboxBoxEdit怎样绑定键值对选项

    场景 DevExpress的下拉框控件ComboBoxEdit控件的使用: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/1028 ...

随机推荐

  1. Centos75 firewalld防火墙

    Centos75 防火墙iptables被firewalld取代 #启动firewalld systemctl start firewalld #查看firewalld systemctl statu ...

  2. 微信小程序:页面配置 page.json

    微信小程序:页面配置 page.json 一.页面配置 page.json 如果整个小程序的风格是蓝色调,那么可以在 app.json 里边声明顶部颜色是蓝色即可. 实际情况可能不是这样,可能你小程序 ...

  3. MFC读写EXIF信息,图片非占用

    MFC读写EXIF信息 读取有类库可以直接调用,网络上有直接可以用的:但是写Exif的资料非常少,我花了一点时间研究收集,终于成功. 将相关的资料共享.主要是借助gdi+,需要注意的地方很多   // ...

  4. InstallShieldPro 2015中Basic MSI工程类型如何调用InstallScript脚本

    转载:http://blog.csdn.net/mengzhishen/article/details/8953901 这是一个Basic MSI基础知识. A. 首先在Installation De ...

  5. 生成二维码Base64图片

    这个写了,但是自己没有用,发现浏览器有的不兼容 代码: string str = System.Configuration.ConfigurationManager.AppSettings[" ...

  6. [转]Python的getattr(),setattr(),delattr(),hasattr()

    getattr()函数是Python自省的核心函数,具体使用大体如下: 获取对象引用getattrGetattr用于返回一个对象属性,或者方法 class A: def __init__(self): ...

  7. Gym 101147J Whistle's New Car(dfs)

    https://vjudge.net/problem/Gym-101147J 题意: 有n个城市,每个城市有一个权值,表示在这个城市的加油站可以加多少油. 现在要计算每个城市i,有多少个城市j可以到达 ...

  8. hdu——1873(优先队列)

    看病要排队 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submi ...

  9. div固定顶部和底部

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  10. Python - Learn Note (2)

    Python注释 Python的注释以#开头,后面的文字直到行尾都算注释 Python基本数据类型 整数.浮点数(浮点数也就是小数,之所以称为浮点数,是因为按照科学记数法表示时,一个浮点数的小数点位置 ...