C绘制渐变矩形代码.docVIP

  • 9
  • 0
  • 约3.7千字
  • 约 4页
  • 2017-06-07 发布于重庆
  • 举报
C绘制渐变矩形代码

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 Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { ColorDialog dlg1 = new ColorDialog(); dlg1.Color = this.button3.BackColor; 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 (dlg2.ShowDialog() == DialogResult.OK) this.button4.BackColor = dlg2.Color; } private void Form1_Load(object sender, EventArgs e) { button3.Text = ; button3.Enabled = false; button3.ForeColor = this.BackColor; button4.Text = ; button4.Enabled = false; button4.ForeColor = this.BackColor; checkBox1.Checked = true; } private void Form1_Paint(object sender, PaintEventArgs e) { } private void radioButton1_Click(object sender, EventArgs e) { if (checkBox1.Checked) { if (radioButton1.Checked) { Brush brush1 = new LinearGradientBrush(new Point(10, 10), new Point(10, 50), this.button3.BackColor, this.button4.BackColor); Graphics g; g = this.CreateGraphics(); g.FillRectangle(brush1, 20, 60, 220, 180); brush1.Dispose(); }

文档评论(0)

1亿VIP精品文档

相关文档