using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;//提供高级的二维和矢量图形功能
namespace Example010_渐变的窗口背景
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Color FColor = Color.Blue;//渐变起始色
Color TColor = Color.Yellow;//渐变结束色
Brush b = new LinearGradientBrush(this.ClientRectangle, FColor, TColor, LinearGradientMode.ForwardDiagonal);
g.FillRectangle(b, this.ClientRectangle);
}
private void Form1_Resize(object sender, EventArgs e)
{
this.Invalidate();
}
}
}
渐变的窗口背景(C#2005)
最新推荐文章于 2023-12-26 13:23:00 发布