iSpyApplication.Controls.FloorPlanControl.OnPaint C# (CSharp) Method

OnPaint() protected method

protected OnPaint ( PaintEventArgs pe ) : void
pe PaintEventArgs
return void
        protected override void OnPaint(PaintEventArgs pe)
        {
            Graphics gPlan = pe.Graphics;
            Rectangle rc = ClientRectangle;

            int textpos = rc.Height - 20;

            try
            {

                if (_imgview != null)
                {
                    if (!_minimised)
                        gPlan.DrawImage(_imgview, rc.X + 1, rc.Y + 1, rc.Width - 2, rc.Height - 26);

                    gPlan.CompositingMode = CompositingMode.SourceOver;
                    gPlan.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
                    gPlan.DrawString(LocRm.GetString("FloorPlan") + ": " + Fpobject.name, _drawFont,
                                _drawBrush,
                                new PointF(5, textpos));
                }
            }
            catch (Exception ex)
            {
                Logger.LogExceptionToFile(ex);
            }

            if (_mouseMove > Helper.Now.AddSeconds(-3) && MainForm.Conf.ShowOverlayControls)
            {
                DrawOverlay(gPlan);
            }

            using (var grabBrush = new SolidBrush(BorderColor))
            using (var borderPen = new Pen(grabBrush, BorderWidth))
            {
                gPlan.DrawRectangle(borderPen, 0, 0, rc.Width - 1, rc.Height - 1);

                if (!MainForm.LockLayout)
                {
                    var borderPoints = new[]
                                        {
                                            new Point(rc.Width - 15, rc.Height), new Point(rc.Width, rc.Height - 15),
                                            new Point(rc.Width, rc.Height)
                                        };
                    gPlan.FillPolygon(grabBrush, borderPoints);

                }
            }

            base.OnPaint(pe);
        }