none
22222222222 RRS feed

  • 질문

  • using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Drawing;

    namespace 이우승_과제16
    {
        class DrawData
        {
            public Point startPoint;
            public Point endPoint;
            public Pen pen;
            public Color pen_color;
            public int drawMode;
            public Brush brush;
            bool fill;

            public DrawData(Point x, Point y, Color p, int dMode, float w)
            {
                startPoint = x;
                endPoint = y;
                pen_color = p;
                pen = new Pen(pen_color, w);
                drawMode = dMode;
            }

            public DrawData(Point x, Point y, Color p, Color b, bool f, int dMode, float w)
            {
                startPoint = x;
                endPoint = y;
                pen_color = p;
                pen = new Pen(pen_color, w);
                brush = new SolidBrush(b);
                fill = f;
                drawMode = dMode;
            }

            public void drawData(Graphics g)
            {
                Rectangle rect;
                switch (drawMode)
                {
                    case 1:
                        g.DrawLine(pen, startPoint, endPoint);
                        break;
                    case 2:
                        g.DrawLine(pen, startPoint, endPoint);
                        break;
                    case 3:
                        rect = new Rectangle(startPoint.X, startPoint.Y, endPoint.X - startPoint.X,
                        endPoint.Y - startPoint.Y);
                        if (fill) g.FillEllipse(brush, rect);
                        g.DrawEllipse(pen, rect);
                        break;
                    case 4:
                        rect = new Rectangle(startPoint.X, startPoint.Y, endPoint.X - startPoint.X,
                        endPoint.Y - startPoint.Y);
                        if (fill) g.FillRectangle(brush, rect);
                        g.DrawRectangle(pen, rect);
                        break;
                    case 5:
                        g.DrawLine(pen, startPoint, endPoint);
                        break;
                }

            }

     

       

        }

    }

    2009년 12월 9일 수요일 오전 1:15