{
Point[] pt = { new Point(10,22) ,
new Point(188,246),
new Point(280,192),
new Point(250,48)
};
e.Graphics.FillClosedCurve (Brushes.Blue,pt);
e.Graphics.DrawClosedCurve (Pens.Red,pt);
}
Point[] pt = { new Point(10,22) ,
new Point(188,246),
new Point(280,192),
new Point(250,48)
};
e.Graphics.FillClosedCurve (Brushes.Blue,pt);
e.Graphics.DrawClosedCurve (Pens.Red,pt);
}
------------------------------------------------------------------
this.SetClientSizeCore(500, 600);
HatchBrush brush;
int x = 20;
int y = 20;
foreach (HatchStyle brushStyle in Enum.GetValues(typeof(HatchStyle)))
{
brush = new HatchBrush(brushStyle, Color.Navy, Color.Yellow);
e.Graphics.FillRectangle(brush, x, y, 40, 20);
y += 30;
if ((y + 30) > this.ClientSize.Height)
{
y = 20;
x += 180;
HatchBrush brush;
int x = 20;
int y = 20;
foreach (HatchStyle brushStyle in Enum.GetValues(typeof(HatchStyle)))
{
brush = new HatchBrush(brushStyle, Color.Navy, Color.Yellow);
e.Graphics.FillRectangle(brush, x, y, 40, 20);
y += 30;
if ((y + 30) > this.ClientSize.Height)
{
y = 20;
x += 180;
}
}
}
------------------------------------------------------------------------------------
Image image = Image.FromFile("C:\\Documents and
Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Blue
hills.jpg");
TextureBrush brush = new TextureBrush(image);
Rectangle rect = new Rectangle(10, 10, 180, 150);
e.Graphics.FillEllipse(brush, rect);
Rectangle rect = new Rectangle(10, 10, 180, 150);
e.Graphics.FillEllipse(brush, rect);
------------------------------------------------------------------------------
private void panel1_Paint(object sender, PaintEventArgs e)
{
LinearGradientBrush pnlGdt =
new LinearGradientBrush(panel1.ClientRectangle,
Color.Yellow, Color.Navy, 0f, true);
e.Graphics.FillRectangle(pnlGdt, panel1.ClientRectangle);
pnlGdt.Dispose();
}
private void panel2_Paint(object sender, PaintEventArgs e)
{
LinearGradientBrush pnlGdt =
new LinearGradientBrush(panel2.ClientRectangle,
Color.Yellow, Color.Navy, 90f, true);
e.Graphics.FillRectangle(pnlGdt, panel2.ClientRectangle);
pnlGdt.Dispose();
}
{
LinearGradientBrush pnlGdt =
new LinearGradientBrush(panel1.ClientRectangle,
Color.Yellow, Color.Navy, 0f, true);
e.Graphics.FillRectangle(pnlGdt, panel1.ClientRectangle);
pnlGdt.Dispose();
}
private void panel2_Paint(object sender, PaintEventArgs e)
{
LinearGradientBrush pnlGdt =
new LinearGradientBrush(panel2.ClientRectangle,
Color.Yellow, Color.Navy, 90f, true);
e.Graphics.FillRectangle(pnlGdt, panel2.ClientRectangle);
pnlGdt.Dispose();
}
-----------------------------------------------------------------------------
private void panel1_Paint(object sender, PaintEventArgs e)
{
LinearGradientBrush pnlGdt =
new LinearGradientBrush(panel1.ClientRectangle,
Color.Yellow, Color.Navy, 0f, true);
e.Graphics.FillRectangle(pnlGdt, panel1.ClientRectangle);
pnlGdt.Dispose();
}
private void panel2_Paint(object sender, PaintEventArgs e)
{
LinearGradientBrush pnlGdt =
new LinearGradientBrush(panel2.ClientRectangle,
Color.Yellow, Color.Navy, 90f, true);
e.Graphics.FillRectangle(pnlGdt, panel2.ClientRectangle);
pnlGdt.Dispose();
}
{
LinearGradientBrush pnlGdt =
new LinearGradientBrush(panel1.ClientRectangle,
Color.Yellow, Color.Navy, 0f, true);
e.Graphics.FillRectangle(pnlGdt, panel1.ClientRectangle);
pnlGdt.Dispose();
}
private void panel2_Paint(object sender, PaintEventArgs e)
{
LinearGradientBrush pnlGdt =
new LinearGradientBrush(panel2.ClientRectangle,
Color.Yellow, Color.Navy, 90f, true);
e.Graphics.FillRectangle(pnlGdt, panel2.ClientRectangle);
pnlGdt.Dispose();
}
private void panel3_Paint(object sender, PaintEventArgs e)
{
GraphicsPath path = new GraphicsPath();
path.AddEllipse(panel3.ClientRectangle);
PathGradientBrush br = new PathGradientBrush(path);
br.CenterPoint = new PointF(panel3.ClientRectangle.Width / 2,
panel3.ClientRectangle.Height / 2);
br.CenterColor = Color.Navy;
br.SurroundColors = new Color[] { Color.Yellow };
e.Graphics.FillPath(br, path);
}
}
}
{
GraphicsPath path = new GraphicsPath();
path.AddEllipse(panel3.ClientRectangle);
PathGradientBrush br = new PathGradientBrush(path);
br.CenterPoint = new PointF(panel3.ClientRectangle.Width / 2,
panel3.ClientRectangle.Height / 2);
br.CenterColor = Color.Navy;
br.SurroundColors = new Color[] { Color.Yellow };
e.Graphics.FillPath(br, path);
}
}
}
-------------------------------------------------------------------------------------
private void panel3_Paint(object sender, PaintEventArgs e)
{
GraphicsPath path = new GraphicsPath();
path.AddEllipse(panel3.ClientRectangle);
PathGradientBrush br = new PathGradientBrush(path);
br.CenterPoint = new PointF(panel3.ClientRectangle.Width / 1,
panel3.ClientRectangle.Height / 4);
br.CenterColor = Color.Navy;
br.SurroundColors = new Color[] { Color.Yellow };
e.Graphics.FillPath(br, path);
}
{
GraphicsPath path = new GraphicsPath();
path.AddEllipse(panel3.ClientRectangle);
PathGradientBrush br = new PathGradientBrush(path);
br.CenterPoint = new PointF(panel3.ClientRectangle.Width / 1,
panel3.ClientRectangle.Height / 4);
br.CenterColor = Color.Navy;
br.SurroundColors = new Color[] { Color.Yellow };
e.Graphics.FillPath(br, path);
}


ไม่มีความคิดเห็น:
แสดงความคิดเห็น