winform 勾选可以改变框控件
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 勾选可以改变框控件的更多相关文章
- layui 多选下拉框 控件 样式改变原因
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Java通过复选框控件数组实现添加多个复选框控件
编写程序,通过复选框控件数组事先选择用户爱好信息的复选框,在该程序中,要求界面中的复选框数量可以根据指定复选框名称的字符串数组的长度来自动调节. 思路如下: 创建JPanel面板对象: 使用JPane ...
- CheckBox复选框控件
CheckBox复选框控件 一.简介 1. 2.类结构图 二.CheckBox复选框控件使用方法 这里是使用java代码在LinearLayout里面添加控件 1.新建LinearLayout布局 2 ...
- css input checkbox复选框控件 样式美化的多种方案
checkbox复选框可能是网站中常用的html元素,但大多数人并不满意它的默认样式,这篇文章就讲讲如何实现input checkbox复选框控件 样式美化效果. 资源网站大全 https://55w ...
- [WinForm]WinForm跨线程UI操作常用控件类大全
前言 在C#开发的WinForm窗体程序开发的时候,经常会使用多线程处理一些比较耗时之类的操作.不过会有一个问题:就是涉及到跨线程操作UI元素. 相信才开始接触的人一定会遇上这个问题. 为了解决这个问 ...
- MFC编程入门之二十四(常用控件:列表框控件ListBox)
前面两节讲了比较常用的按钮控件,并通过按钮控件实例说明了具体用法.本文要讲的是列表框控件(ListBox)及其使用实例. 列表框控件简介 列表框给出了一个选项清单,允许用户从中进行单项或多项选择,被选 ...
- 通过winForm控制webForm的上传控件file的值
文件上传是日常开发中经常遇到的,文件上传用的最多的当然是上传控件file了,一个form表单,其中有一点就是form表单的enctype属性设置为multipart/form-data,呵呵,这个在所 ...
- VS2010/MFC编程入门之二十四(常用控件:列表框控件ListBox)
前面两节讲了比较常用的按钮控件,并通过按钮控件实例说明了具体用法.本文要讲的是列表框控件(ListBox)及其使用实例. 列表框控件简介 列表框给出了一个选项清单,允许用户从中进行单项或多项选择,被选 ...
- DevExpress的下拉框控件ComboxBoxEdit怎样绑定键值对选项
场景 DevExpress的下拉框控件ComboBoxEdit控件的使用: https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/1028 ...
随机推荐
- Centos75 安装 postgresql11
切换到root账户, #安装yum 源 yum install https://download.postgresql.org/pub/repos/yum/11/redhat/rhel-7-x86_6 ...
- What's the difference between SDK and Runtime in .NET Core?
What's the difference between SDK and Runtime in .NET Core? Answer1 According to the .Net Core Guide ...
- 使用Python登陆QQ邮箱发送垃圾邮件 简单实现
参考:Python爱好者 知乎文章 需要做的是: 1.邮箱开启SMTP功能 2.获取授权码 上述两步百度都有. 源码: #!/usr/bin/env python from email.mime.te ...
- UVa 11404 回文子序列(LCS求最长回文串长度)
https://vjudge.net/problem/UVA-11404 题意: 给定一个由小写字母组成的字符串,删除其中的0个或多个字符,使得剩下的字母(顺序不变)组成一个尽量长的回文串.如果有多解 ...
- python fromkeys() 创建字典
# d = dict.fromkeys("张无忌","赵敏") #创建字典 # print(d)#{'张': '赵敏', '无': '赵敏', '忌': '赵敏 ...
- python 字符串压缩
import zlib s = b'witch which has which witches wrist watch' print(len(s)) t = zlib.compress(s) prin ...
- display:box,按比列划分,水平均分,及垂直等高
一.按比例划分 <div class="test"> <p id="p1">Hello</p> <p id=" ...
- [javascript]javascript取得html元素,取得html样式,修改html样式
一.取得html元素 详情见:https://www.jb51.net/article/116460.htm 1.通过ID获取(getElementById) document.getElementB ...
- JSP 隐含对象
JSP 隐含对象 JSP隐含对象是JSP容器为每个页面提供的Java对象,开发者可以直接使用它们而不用显式声明.JSP隐含对象也被称为预定义变量. JSP所支持的九大隐含对象: 对象描述 reques ...
- 一张思维导图教你使用google一下
导图总览 google搜索技巧.png 双引号 代表完全匹配搜索 也就是说搜索结果返回的页面包含双引号中出现的所有的词,连顺序也必须完全匹配 例如搜索"java 排序"与无引号的j ...