int x1, y1 = 0;
bool c = false;
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
x1 = e.X;
y1 = e.Y;
c = true;
al.Add(new Point(e.X, e.Y));
}
System.Collections.ArrayList al = new System.Collections.ArrayList();
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (c == true)
{
System.Drawing.Drawing2D.LinearGradientBrush brush1= new
System.Drawing.Drawing2D.LinearGradientBrush(
new Rectangle(0, 0, 2, 2), Color.YellowGreen, Color.Green,
System.Drawing.Drawing2D.LinearGradientMode.BackwardDiagonal);
Bitmap b = new Bitmap(Width, Height);
Graphics g = Graphics.FromImage(b);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
al.Add(new Point(e.X, e.Y));
Point[] p = new Point[al.Count];
al.CopyTo(p);
g.DrawLines(new Pen(brush1,5), p);
this.BackgroundImage = b;
}
}
private void Form1_MouseUp(object sender, MouseEventArgs e)
{
c = false;
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
int a, b, c, d = 0;
a = int.Parse(numericUpDown1.Value.ToString());
b = a * 3600;
c = b / 1000;
d = 50;
System.Drawing.Drawing2D.LinearGradientBrush b1 = new System.Drawing.Drawing2D.LinearGradientBrush(new
Rectangle(50, 20, 190, 170), Color.Yellow, Color.Green, System.Drawing.Drawing2D.LinearGradientMode.ForwardDiagonal);
SolidBrush sb = new SolidBrush(Color.Black);
Bitmap bit = new Bitmap(Width, Height);
Graphics g = Graphics.FromImage(bit);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
g.DrawPie(new Pen(sb, 1), d, 20, 190, 170, 0, 360);
sb.Color = Color.Silver;
g.FillPie(sb, d, 20, 190, 170, 0, 360);
sb.Color = Color.Black;
g.DrawPie(new Pen(sb, 1), d, 20, 190, 170, -c, c);
sb.Color = Color.Yellow;
g.FillPie(b1, d, 20, 190, 170, -c, c);
this.BackgroundImage = bit;
}
private void Form1_Load(object sender, EventArgs e)
{
numericUpDown1_ValueChanged(null, null);
}
private void Form1_Load(object sender, EventArgs e)
{
SolidBrush sb = new SolidBrush(Color.Black);
Bitmap bi = new Bitmap(Width, Height);
Graphics g = Graphics.FromImage(bi);
Rectangle r = new Rectangle(20, 20, 150, 130);
sb.Color = Color.Red;
g.FillRectangle(sb, r);
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
sb.Color = Color.Black;
g.DrawRectangle(new Pen(sb), r);
Rectangle r1 = new Rectangle(40, 40, 150, 130);
sb.Color = Color.FromArgb(150, 255, 255, 0);
g.FillRectangle(sb, r1);
sb.Color = Color.Black;
g.DrawRectangle(new Pen(sb), r1);
g.DrawLine(new Pen(sb), 20, 20, 40, 40);
g.DrawLine(new Pen(sb), 170, 20, 190, 40);
g.DrawLine(new Pen(sb), 20, 150, 40, 170);
g.DrawLine(new Pen(sb), 170, 150, 190, 170);
this.BackgroundImage = bi;
}
private void DrawBorder3D(Graphics g, ref Rectangle rc,
Border3DStyle borderStyle)
{
ControlPaint.DrawBorder3D(g, rc, borderStyle);
g.DrawString(borderStyle.ToString(), Font, Brushes.Black,
rc.Width + 5, rc.Y + (rc.Height - Font.Height) / 2);
rc.Offset(0, rc.Height + 5);
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Rectangle rc = new Rectangle(0, 0, 50, 25);
DrawBorder3D(e.Graphics, ref rc, Border3DStyle.Adjust);
DrawBorder3D(e.Graphics, ref rc, Border3DStyle.Bump);
DrawBorder3D(e.Graphics, ref rc, Border3DStyle.Etched);
DrawBorder3D(e.Graphics, ref rc, Border3DStyle.Flat);
DrawBorder3D(e.Graphics, ref rc, Border3DStyle.Raised);
DrawBorder3D(e.Graphics, ref rc, Border3DStyle.RaisedInner);
DrawBorder3D(e.Graphics, ref rc, Border3DStyle.RaisedOuter);
DrawBorder3D(e.Graphics, ref rc, Border3DStyle.Sunken);
DrawBorder3D(e.Graphics, ref rc, Border3DStyle.SunkenInner);
DrawBorder3D(e.Graphics, ref rc, Border3DStyle.SunkenOuter);
}