ImageGlass.ImageBox.DrawSelection C# (CSharp) Method

DrawSelection() protected method

Draws the selection region.
protected DrawSelection ( PaintEventArgs e ) : void
e PaintEventArgs /// The instance containing the event data. ///
return void
        protected virtual void DrawSelection(PaintEventArgs e)
        {
            RectangleF rect;

            e.Graphics.SetClip(GetInsideViewPort(true));

            rect = GetOffsetRectangle(SelectionRegion);

            using (Brush brush = new SolidBrush(Color.FromArgb(128, SelectionColor)))
            {
                e.Graphics.FillRectangle(brush, rect);
            }

            using (Pen pen = new Pen(SelectionColor))
            {
                e.Graphics.DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height);
            }

            e.Graphics.ResetClip();
        }
ImageBox