Two Color Form using 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
WindowsFormsApplication10
{
public partial class Form1 : Form
{
public
Form1()
{
InitializeComponent();
}
private
void Form1_Load(object
sender, EventArgs e)
{
//
Invalidate, or last rendered image will just be scaled
// to new
size
this.Invalidate();
}
private
void Form1_Paint(object
sender, PaintEventArgs e)
{
Rectangle
BaseRectangle =
new
Rectangle(0, 0, this.Width,this.Height);
Brush
Gradient_Brush = new LinearGradientBrush(BaseRectangle,
Color.Chocolate, Color.LightSlateGray,
LinearGradientMode.Vertical);
e.Graphics.FillRectangle(Gradient_Brush, BaseRectangle);
//Rectangle
BaseRectangle =new Rectangle(0, 0, this.Width - 1, this.Height - 1);
//HatchBrush
hb1 = new HatchBrush(HatchStyle.SolidDiamond,Color.Pink,Color.Purple);
//e.Graphics.FillRectangle(hb1,BaseRectangle);
}
}
}
No comments:
Post a Comment