private void panel1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen p1 = new Pen(Color.Black, 5);
int yL = 40;
foreach(string ds in Enum.GetNames(typeof(DashStyle)))
{
if (ds != "Custom")
{
foreach(string lc in Enum.GetNames(typeof(LineCap))) {
p1.DashStyle = (DashStyle)(Enum.Parse(typeof(DashStyle),ds));
p1.StartCap = (LineCap)(Enum.Parse(typeof(LineCap),lc));
p1.EndCap = (LineCap)(Enum.Parse(typeof(LineCap), lc));
g.DrawLine(p1, 20, yL, 120, yL);
g.DrawString("DashStyle:"+ds+" LineCap:"+lc, new Font("Arial", 10), Brushes.Black, 140, yL-8);
yL+=20;
}
}
}
p1.Dispose();
}
|