void SetArea()
{
this.ScreenBox.Left = this.Selection.X;
this.ScreenBox.Top = this.Selection.Y;
this.ScreenBox.Width = this.Selection.Width;
this.ScreenBox.Height = this.Selection.Height;
{
bool flipAround = this.ScreenBox.Top - this.picWidth.Height < 0;
this.picWidth.Left = this.ScreenBox.Left;
this.picWidth.Top = !flipAround ? (this.ScreenBox.Top - this.picWidth.Height) : (this.ScreenBox.Top + this.ScreenBox.Height);
this.picWidth.Width = this.ScreenBox.Width > 0 ? this.ScreenBox.Width : 1;
Bitmap bmp = new Bitmap(this.picWidth.Width, this.picWidth.Height);
Graphics g = Graphics.FromImage(bmp);
g.DrawLine(Pens.White, new Point(0, 0), new Point(0, bmp.Height));
g.DrawLine(Pens.White, new Point(0, bmp.Height / 2), new Point(bmp.Width, bmp.Height / 2));
g.DrawLine(Pens.White, new Point(bmp.Width - 1, 0), new Point(bmp.Width - 1, bmp.Height));
g.DrawString(this.Selection.Width.ToString(), SystemFonts.DefaultFont, Brushes.White, new PointF(!flipAround ? 10 : bmp.Width - 40, 0));
this.picWidth.Image = bmp;
}
{
bool flipAround = this.ScreenBox.Left - this.picHeight.Width < 0;
this.picHeight.Left = !flipAround ? (this.ScreenBox.Left - this.picHeight.Width) : (this.ScreenBox.Left + this.ScreenBox.Width);
this.picHeight.Top = this.ScreenBox.Top;
this.picHeight.Height = this.ScreenBox.Height > 0 ? this.ScreenBox.Height : 1;
Bitmap bmp = new Bitmap(this.picHeight.Width, this.picHeight.Height);
Graphics g = Graphics.FromImage(bmp);
g.DrawLine(Pens.White, new Point(0, 0), new Point(bmp.Width, 0));
g.DrawLine(Pens.White, new Point(bmp.Width / 2, 0), new Point(bmp.Width / 2, bmp.Height));
g.DrawLine(Pens.White, new Point(0, bmp.Height - 1), new Point(bmp.Width, bmp.Height - 1));
g.TranslateTransform(0, !flipAround ? 40 : bmp.Height - 10);
g.RotateTransform(-90);
g.DrawString(this.Selection.Height.ToString(), SystemFonts.DefaultFont, Brushes.White, new PointF());
this.picHeight.Image = bmp;
}
}