Пример #1
0
        private void drawRectangle(Graphics g, GraphicElements current, Pen pen)
        {
            int x = current.X, y = current.Y, dx = current.DX, dy = current.DY;

            if (dx < 0)
            {
                x  = x + dx;
                dx = -dx;
            }
            if (dy < 0)
            {
                y  = y + dy;
                dy = -dy;
            }
            g.DrawRectangle(pen, x, y, dx, dy);
        }
Пример #2
0
        private void drawEllipse(Graphics g, GraphicElements current, Pen pen)
        {
            int x = current.X, y = current.Y, dx = current.DX, dy = current.DY;

            if (current.DX < 0)
            {
                x  = current.X + current.DX;
                dx = -current.DX;
            }
            if (current.DY < 0)
            {
                y  = current.Y + current.DY;
                dy = -current.DY;
            }
            g.DrawEllipse(pen, x, y, dx, dy);
        }
Пример #3
0
 private void CreateCurrent(ElementType type)
 {
     current = new GraphicElements {
         type = type
     };
 }
Пример #4
0
 private void drawLine(Graphics g, GraphicElements current, Pen pen)
 {
     g.DrawLine(pen, current.X, current.Y, current.X + current.DX, current.Y + current.DY);
 }