Accord.Controls.PointBox.OnPaint C# (CSharp) Метод

OnPaint() защищенный Метод

Raises the E:System.Windows.Forms.Control.Paint event.
protected OnPaint ( PaintEventArgs e ) : void
e PaintEventArgs A that contains the event data.
Результат void
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            Graphics g = e.Graphics;
            g.SmoothingMode = SmoothingMode.AntiAlias;
            g.FillRectangle(Brushes.White, ClientRectangle);

            float r = 5;

            float width = ClientRectangle.Width;
            float height = ClientRectangle.Height;

            // Convert from [-1, +1] to [0, width]
            float cursorX = width * (pointX + 1f) / 2f;
            float cursorY = height * (-pointY + 1f) / 2f;

            cursorX = Math.Max(0, Math.Min(cursorX, width));
            cursorY = Math.Max(0, Math.Min(cursorY, height));


            // Draw crosshair
            g.DrawLine(pen, cursorX - r, cursorY, cursorX + r, cursorY);
            g.DrawLine(pen, cursorX, cursorY - r, cursorX, cursorY + r);
        }