1、 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Drawing2D; using System.Linq; using System.Text; using System.Windows.Forms; namespace gaolinglong35jianbiantuxing { public partial class Form
2、1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { ColorDialog dlg1 = new ColorDialog(); dlg1.Color = this.button3.BackColor;
3、if (dlg1.ShowDialog() == DialogResult.OK) this.button3.BackColor = dlg1.Color; } private void button2_Click(object sender, EventArgs e) { ColorDialog dlg2 = new ColorDialog(); dlg2.Color = this.button4.BackColor; if (
4、dlg2.ShowDialog() == DialogResult.OK) this.button4.BackColor = dlg2.Color; } private void Form1_Load(object sender, EventArgs e) { button3.Text = ""; button3.Enabled = false; button3.ForeColor = t
5、his.BackColor; button4.Text = ""; button4.Enabled = false; button4.ForeColor = this.BackColor; checkBox1.Checked = true; } private void Form1_Paint(object sender, PaintEventArgs e) {
6、 } private void radioButton1_Click(object sender, EventArgs e) { if (checkBox1.Checked) { if (radioButton1.Checked) { Brush brush1 = new LinearGradientBrush(new Point(10, 10), ne
7、w Point(10, 50), this.button3.BackColor, this.button4.BackColor); Graphics g; g = this.CreateGraphics(); g.FillRectangle(brush1, 20, 60, 220, 180); brush1.Dispose(); } } }
8、 private void radioButton2_Click(object sender, EventArgs e) { if (checkBox1.Checked) { if (radioButton2.Checked) { Brush brush1 = new LinearGradientBrush(new Point(10, 10), new Point(50, 10), this.button3
9、BackColor, this.button4.BackColor); Graphics g; g = this.CreateGraphics(); g.FillRectangle(brush1, 20, 60, 220, 180); brush1.Dispose(); } } } private void radioButto
10、n3_Click(object sender, EventArgs e) { if (checkBox1.Checked) { if (radioButton3.Checked) { Brush brush1 = new LinearGradientBrush(new Point(10, 10), new Point(50, 50), this.button3.BackColor, this.button4.Back
11、Color); Graphics g; g = this.CreateGraphics(); g.FillRectangle(brush1, 20, 60, 220, 180); brush1.Dispose(); } } } private void radioButton4_Click(object sender, Event
12、Args e) { if (checkBox1.Checked) { if (radioButton4.Checked) { Brush brush1 = new LinearGradientBrush(new Point(10, 10), new Point(50, 50), this.button4.BackColor, this.button3.BackColor); Graphics g; g = this.CreateGraphics(); g.FillRectangle(brush1, 20, 60, 220, 180); brush1.Dispose(); } } } } } 运行结果如下图:






