zoukankan      html  css  js  c++  java
  • WinForm控件之【Button】

    基本介绍

    普通按钮大部分情况下用作页面对某系列操作后的提交确认,应用较为广泛,在winfrom控件当中使用设置都相对的简单。

    常设置属性、事件

     Image:控件上显示的图片;

     Enabled  :指示是否启用该控件,true为启用状态用户可单击控件触发事件,false为禁用状态呈现浅灰状态用户无法单击控件触发事件;

     Name:指示代码中用来标识该对象的名称;

     Text:与控件关联的文本,显示给用户看的内容说明;

     Click事件:单击组件时发生;

    事例举例

     

    private void button1_Click(object sender, EventArgs e)
            {
                if (this.button2.BackColor == SystemColors.Control)
                {
                    this.button2.BackColor = Color.Transparent;
                    this.button2.FlatStyle = FlatStyle.Flat;
                    this.button2.FlatAppearance.BorderSize = 0;
                    this.button2.FlatAppearance.MouseOverBackColor = Color.Transparent;
                    this.button2.FlatAppearance.MouseDownBackColor = Color.Transparent;
                    this.button2.UseVisualStyleBackColor = false;
                }
                else
                {
                    this.button2.BackColor = SystemColors.Control;
                    this.button2.FlatStyle = FlatStyle.Standard;
                    this.button2.FlatAppearance.BorderSize = 1;
                    this.button2.FlatAppearance.MouseOverBackColor = Color.Empty;
                    this.button2.FlatAppearance.MouseDownBackColor = Color.Empty;
                    this.button2.UseVisualStyleBackColor = true;
                }
            }

     控件属性功能相当齐全,精心设置花样会很多,具体看官们可自行研究,在此不再一一例举!

     

  • 相关阅读:
    正则表达式匹配中国区的电话号码
    落户
    存储过程与函数的区别转载
    asp.net页面从初始化到卸载事件顺序转
    .net连接Oracle数据库 常见问题
    sql触发器的类型
    (转) C++中extern “C”含义深层探索
    vmware 收缩越来越大的磁盘文件
    (转)一些常用的网站
    工具:P/Invoke Interop Assistant
  • 原文地址:https://www.cnblogs.com/ljhandsomeblog/p/11125150.html
Copyright © 2011-2022 走看看