コード例 #1
0
ファイル: Diagram.cs プロジェクト: MacMinhHoang/Paint
 public override void draw(CommonGraphics g)
 {
     foreach (Block block in blocks)
     {
         block.draw(g);
     }
 }
コード例 #2
0
 public override void draw(CommonGraphics g)
 {
     PointF[] pts = StarPoints(5, new Rectangle(info.start.X, info.start.Y, info.end.X, info.end.Y));
     for (int i = 0; i < 4; i++)
     {
         g.DrawLine((int)pts[i].X, (int)pts[i].Y, (int)pts[i + 1].X, (int)pts[i + 1].Y);
     }
     g.DrawLine((int)pts[4].X, (int)pts[4].Y, (int)pts[0].X, (int)pts[0].Y);
 }
コード例 #3
0
ファイル: ShapeDecorator.cs プロジェクト: MacMinhHoang/Paint
        public override void draw(CommonGraphics g)
        {
            int x              = coreShape.info.points[0].X,
                        y      = coreShape.info.points[0].Y,
                        width  = coreShape.info.width,
                        height = coreShape.info.height;

            coreShape.draw(g);
            if (coreShape.GetType() == typeof(Rect))
            {
                g.drawRecShadow(x, y, width, height);
            }
        }
コード例 #4
0
        public override void draw(CommonGraphics g)
        {
            int x1          = info.points[0].X,
                         y1 = info.points[0].Y,
                         x2 = x1 + 20,
                         y2 = y1 - 80,
                         x3 = x1 + 150,
                         y3 = y1 - 80,
                         x4 = x1 + 130,
                         y4 = y1;

            g.drawLine(x1, y1, x2, y2);
            g.drawLine(x2, y2, x3, y3);
            g.drawLine(x3, y3, x4, y4);
            g.drawLine(x4, y4, x1, y1);
        }
コード例 #5
0
ファイル: Shape.cs プロジェクト: MacMinhHoang/Paint
        public override void draw(CommonGraphics g)
        {
            int x1  = info.points[0].X,
                 y1 = info.points[0].Y,
                 x2 = x1 + 40,
                 y2 = y1 - 100,
                 x3 = x1 + 80,
                 y3 = y1,
                 x4 = x1 - 20,
                 y4 = y1 - 60,
                 x5 = x1 + 100,
                 y5 = y1 - 60;

            g.drawLine(x1, y1, x2, y2);
            g.drawLine(x2, y2, x3, y3);
            g.drawLine(x3, y3, x4, y4);
            g.drawLine(x4, y4, x5, y5);
            g.drawLine(x5, y5, x1, y1);
        }
コード例 #6
0
        private void drawBtn_Click(object sender, EventArgs e)
        {
            int a = Int32.Parse(aTxtBox.Text);
            int b = Int32.Parse(bTxtBox.Text);
            int c = Int32.Parse(cTxtBox.Text);
            int d = Int32.Parse(dTxtBox.Text);

            switch (shapeCBB.SelectedIndex)
            {
            case 0:
                shape = new Line(a, b, c, d);
                break;

            case 1:
                shape = new shape.Rectangle(a, b, c, d);
                break;

            case 2:
                shape = new Ellipse(a, b, c, d);
                break;
            }

            if (libCBB.SelectedIndex == 0)
            {
                if (gdiPlus == null)
                {
                    gdiPlus = new GDIPlusCommonGraphics(gGDI, Color.Black, Color.White, false, 255, 2);
                }
                shape.draw(gdiPlus);
            }
            else
            {
                if (cairo == null)
                {
                    cairo = new CairoCommonGraphics(gCairo, Color.Black, Color.White, true, 255, 2);
                }
                shape.draw(cairo);
            }

            shapes.Add(shape);
        }
コード例 #7
0
ファイル: Shape.cs プロジェクト: MacMinhHoang/Paint
 public override void draw(CommonGraphics g)
 {
     g.drawRectangle(info.points[0].X, info.points[0].Y, info.width, info.height);
 }
コード例 #8
0
ファイル: Shape.cs プロジェクト: MacMinhHoang/Paint
 public override void draw(CommonGraphics g)
 {
     g.drawLine(info.points[0].X, info.points[0].Y, info.points[1].X, info.points[1].Y);
 }
コード例 #9
0
ファイル: Shape.cs プロジェクト: MacMinhHoang/Paint
 public abstract void draw(CommonGraphics g);
コード例 #10
0
ファイル: AcBlock.cs プロジェクト: MacMinhHoang/Paint
 public override void draw(CommonGraphics g)
 {
     g.drawEllipse(info.points[0].X, info.points[0].Y, 20, 20);
     g.fillEllipse(info.points[0].X, info.points[0].Y, 20, 20, Color.Black);
 }
コード例 #11
0
        private void MainForm_Paint(object sender, PaintEventArgs e)
        {
            if (effect == null)
            {
                effect = new GDIPlusCommonGraphics(gEffectGDI, Color.Gray, Color.Gray, true, 255, 1);
            }

            if (gr == null)
            {
                gr = new GDIPlusCommonGraphics(gGDI, Color.Black, Color.White, true, 255, 2);
            }
            Shape sh1                    = new shape.Ellipse(10, 10, 100, 60);
            Shape sh2                    = new shape.Ellipse(10, 100, 100, 60);
            Shape sh1WithShadow          = new ShadowEffect(sh1, effect);
            Shape sh2WithShadow          = new ShadowEffect(sh2, effect);
            Shape sh2WithShadowAndBorder = new BorderEffect(sh2WithShadow, effect);

            Shape DFstartBlock = new DFStartBlock(150, 5, 100);
            Shape DFforward1   = new DFForwardBlock(200, 76, 200, 100);
            Shape DFinput      = new DFInputBlock(150, 100, 100);
            Shape DFforward2   = new DFForwardBlock(200, 146, 200, 170);
            Shape DFprocess    = new DFProcessBlock(150, 170, 100);
            Shape DFforward3   = new DFForwardBlock(200, 236, 200, 260);
            Shape DFoutput     = new DFOutputBlock(150, 260, 100);
            Shape DFforward4   = new DFForwardBlock(200, 306, 200, 330);
            Shape DFendBlock   = new DFEndBlock(150, 330, 100);

            sh1WithShadow.draw(gr);
            sh2WithShadowAndBorder.draw(gr);

            Shape FCstart     = new FCStartBlock(280, 20, 100);
            Shape FCforward1  = new FCForwardBlock(330, 68, 330, 100);
            Shape FCinput     = new FCInputBlock(280, 100, 100);
            Shape FCforward2  = new FCForwardBlock(330, 146, 330, 170);
            Shape FCprocess   = new FCProcessBlock(280, 170, 100);
            Shape FCforward3  = new FCForwardBlock(330, 215, 330, 260);
            Shape FCoutput    = new FCOutputBlock(280, 260, 100);
            Shape FCforward4  = new FCForwardBlock(330, 306, 330, 330);
            Shape FCcondition = new FCConditionBlock(280, 330, 100);
            Shape FCforward5  = new FCForwardBlock(330, 376, 330, 400);
            Shape FCend       = new FCEndBlock(280, 400, 100);

            DFstartBlock.draw(gr);
            DFforward1.draw(gr);
            DFinput.draw(gr);
            DFforward2.draw(gr);
            DFprocess.draw(gr);
            DFforward3.draw(gr);
            DFoutput.draw(gr);
            DFforward4.draw(gr);
            DFendBlock.draw(gr);

            FCstart.draw(gr);
            FCforward1.draw(gr);
            FCinput.draw(gr);
            FCforward2.draw(gr);
            FCprocess.draw(gr);
            FCforward3.draw(gr);
            FCoutput.draw(gr);
            FCforward4.draw(gr);
            FCcondition.draw(gr);
            FCforward5.draw(gr);
            FCend.draw(gr);

            shapes.Add(sh1WithShadow);
            shapes.Add(sh2WithShadowAndBorder);
            shapes.Add(DFstartBlock);
            shapes.Add(DFinput);
            shapes.Add(DFprocess);
            shapes.Add(DFoutput);
            shapes.Add(DFendBlock);
            shapes.Add(DFforward1);
            shapes.Add(DFforward2);
            shapes.Add(DFforward3);
            shapes.Add(DFforward4);
            shapes.Add(FCstart);
            shapes.Add(FCinput);
            shapes.Add(FCoutput);
            shapes.Add(FCprocess);
            shapes.Add(FCcondition);
            shapes.Add(FCend);
            shapes.Add(FCforward1);
            shapes.Add(FCforward2);
            shapes.Add(FCforward3);
            shapes.Add(FCforward4);
            shapes.Add(FCforward5);
        }
コード例 #12
0
 protected abstract void format(CommonGraphics g, Shape shape);
コード例 #13
0
ファイル: ShapeDecorator.cs プロジェクト: MacMinhHoang/Paint
 public override void draw(CommonGraphics g)
 {
     g.setHighlightPen();
     coreShape.draw(g);
     g.resetPen();
 }
コード例 #14
0
 public override void draw(CommonGraphics g)
 {
     g.drawString(info.points[0].X, info.points[0].Y, "Start");
     g.drawEllipse(info.points[0].X - 30, info.points[0].Y - 20, 60, 30);
 }
コード例 #15
0
 protected override void format(CommonGraphics g, Shape shape)
 {
     shape.draw(g);
 }
コード例 #16
0
 public override void draw(CommonGraphics g)
 {
     throw new NotImplementedException();
 }
コード例 #17
0
        private void panelcontrol_MouseUp(object sender, MouseEventArgs e)
        {
            End.X = e.X;
            End.Y = e.Y;
            g     = panelcontrol.CreateGraphics();
            DiagramFactory fac  = new DfdFactory();
            ShapeInfo      temp = new ShapeInfo(Start, End);
            DiagramFactory fac2 = new FCFactory();
            CommonGraphics gdi1 = new GdiPlusCommonGraphics(g, panelcontrol);

            //chon graphic
            if (GraphicType == 0)
            {
                gdi = gdi1;
            }
            else
            {
                try
                {
                    Surface s = new Win32Surface(g.GetHdc());
                    Context c = new Context(s);
                    gdi = new CairoCommonGraphics(c);
                }catch (System.DllNotFoundException)
                {
                    GraphicType = 0;
                    MessageBox.Show("DllNotFoundException", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            //chon hinh ve
            switch (ShapeType)
            {
            case 0:
                Shape line = new Line(Start, End);
                line.draw(gdi);

                break;

            case 1:
                Shape rect = new Rect(Start, End);
                rect.draw(gdi);
                break;

            case 2:
                Shape eclip = new Eclip(Start, End);
                eclip.draw(gdi);
                break;

            case 3:

                ABlock startblock = fac.createStartBlock(temp);
                startblock.draw(gdi);
                break;

            case 4:
                ABlock input = fac.createInputBlock(temp);
                input.draw(gdi);
                break;

            case 5:
                ABlock startbl = fac2.createStartBlock(temp);
                startbl.draw(gdi);
                break;

            case 6:
                ABlock inputbl = fac2.createInputBlock(temp);
                inputbl.draw(gdi);
                break;

            case 7:
                Shape star = new Star(Start, End);
                star.draw(gdi);
                break;

            default:
                break;
            }
        }
コード例 #18
0
 public override void draw(CommonGraphics g)
 {
     g.DrawEclipse(info.start.X, info.start.Y, width, height);
 }
コード例 #19
0
 public override void draw(CommonGraphics g)
 {
     g.DrawLine(info.start.X, info.start.Y, info.end.X, info.end.Y);
 }