Bitmap res =
new Bitmap(width, height);
Graphics g =
Graphics.FromImage(res);
g.SmoothingMode = System.Drawing.Drawing2D.
SmoothingMode.HighQuality;
System.Drawing.Drawing2D.
GraphicsPath gp =
new System.Drawing.Drawing2D.
GraphicsPath();
if (lefttoright)
{
gp.AddLine(0, 0, width / 2, height);
gp.AddLine(width / 2, height, width, 0);
gp.AddLine(width, 0, 0, 0);
}
else{
gp.AddLine(0, 0, width, height / 2);
gp.AddLine(width, height / 2, 0, height);
gp.AddLine(0, height, 0, 0);
}
g.FillPath(FillColor, gp);
g.DrawPath(
Pens.Black, gp);