c#线性渐变画刷LinearGradientBrush

 
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using System.Drawing.Drawing2D;
  9. namespace WindowsApplication2
  10. {
  11.     public partial class Form8 : Form
  12.     {
  13.         public Form8()
  14.         {
  15.             InitializeComponent();
  16.         }
  17.         private void button1_Click(object sender, EventArgs e)
  18.         {      
  19.             /*LinearGradientBrush brush = new LinearGradientBrush(this.ClientRectangle, Color.White, Color.Red, LinearGradientMode.Horizontal);
  20.             Graphics g = this.CreateGraphics();
  21.             g.FillRectangle(brush, 1, 1, 100, 100);
  22.             g.DrawString("zhuzhao", this.Font, brush, 1, 1);*/
  23.             /*LinearGradientBrush brush = new LinearGradientBrush(this.ClientRectangle, Color.White, Color.Red, LinearGradientMode.Horizontal);
  24.             brush.SetBlendTriangularShape(0.5f);
  25.             Graphics g = this.CreateGraphics();
  26.             g.FillRectangle(brush, 1, 1, 1000, 100);
  27.             g.DrawString("zhuzhao", this.Font, brush, 1, 1);*/
  28.             LinearGradientBrush brush = new LinearGradientBrush(this.ClientRectangle, Color.White, Color.Red, LinearGradientMode.Horizontal);
  29.             brush.SetSigmaBellShape(0.5f);
  30.             Graphics g = this.CreateGraphics();
  31.             g.FillRectangle(brush, 1, 1, 1000, 100);
  32.             g.DrawString("zhuzhao"this.Font, brush, 1, 1);
  33.         }
  34.     }
  35. }
©️2020 CSDN 皮肤主题: 程序猿惹谁了 设计师:上身试试 返回首页