就是点击之后改变的颜色,怎么实现

解决方案 »

  1.   


    //设置button的背景颜色 
    button.UseVisualStyleBackColor=false
    button.BackColor = System.Drawing.Color.Red
      

  2.   


    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    namespace WindowsApplication1
    {
    public partial class Form1 : Form
    {
    Boolean isTrue = true;
    public Form1()
    {
    InitializeComponent();
    }
    private void button1_Click(object sender, EventArgs e)
    {
    if(isTrue)
    {
    this.button1.Text = "在线";
    this.button1.ForeColor = Color.Blue;
    }
    else
    {
    this.button1.Text = "离线";
    this.button1.ForeColor = Color.Red;
    }
    isTrue = !isTrue;
    }
    }
    }
      

  3.   

            private void button1_Click(object sender, EventArgs e)
            {
                button1.BackColor =Color.FromArgb(255,219,73) ;
            }
      

  4.   

    //设置button的背景颜色 
    button.UseVisualStyleBackColor=false
    button.BackColor = System.Drawing.Color.Red
      

  5.   

    winform按钮界面属性里设置