Esempio n. 1
0
        public override void Draw(Graphics g)
        {
            if (X2 == X1 || Y2 == Y1)
            {
                return;
            }

            g.DrawLine(new Pen(Color.FromArgb(LineAlpha, LineColor.ToColor()), LineThickness),
                       new PointF(X1, Y1), new PointF(X2, Y2));
        }
Esempio n. 2
0
        public virtual void Draw(Graphics g)
        {
            Matrix matrix = new Matrix(1, 0, 0, 1, 0, 0);

            if (Rotation > 0)
            {
                matrix = ApplyRotation(matrix);
            }

            if (Skew != PointF.Empty)
            {
                matrix = ApplySkew(matrix);
            }

            g.Transform = matrix;

            g.DrawRectangle(new Pen(Color.FromArgb(LineAlpha, LineColor.ToColor()), LineThickness), X, Y, Width, Height);
            g.FillRectangle(new SolidBrush(Color.FromArgb(FillAlpha, FillColor.ToColor())), X + LineThickness - (LineThickness / 2), Y + LineThickness - (LineThickness / 2), Width - LineThickness, Height - LineThickness);

            g.ResetTransform();
        }