private void UpdateRegion()
{
Rectangle r = this.ClientRectangle;
Point[] points = new Point[3];
byte[] types = new byte[3];
types[0] = 0; // start
types[1] = 1; // line
types[2] = 1; // line
switch(direction)
{
case 0:
points[0] = new Point(0, r.Height);
points[1] = new Point(r.Width, r.Height);
points[2] = new Point(r.Width / 2, 0);
break;
case 1:
points[0] = new Point(0, r.Height);
points[1] = new Point(0, 0);
points[2] = new Point(r.Width, r.Height / 2);
break;
case 2:
points[0] = new Point(0, 0);
points[1] = new Point(r.Width, 0);
points[2] = new Point(r.Width / 2, r.Height);
break;
case 3:
points[0] = new Point(r.Width, r.Height);
points[1] = new Point(r.Width, 0);
points[2] = new Point(0, r.Height / 2);
break;
}
GraphicsPath path = new GraphicsPath(points, types);
this.Region = new Region(path);
}