Example #1
0
 private void MainWindow_Load(object sender, EventArgs e)
 {
     SizeBar.Value         = size;
     ButtonColor.BackColor = currentColor;
     factoryCircle         = new Factory.ConcreteFactoryCircle();
     factoryRectangle      = new Factory.ConcreteFactoryRectangle();
 }
Example #2
0
 private void DrawLine(Factory.IAbstractFactory factory)
 {
     Brush.IBrush brush = factory.CreateBrush();
     brush.SetGraph(g);
     brush.SetColor(currentColor);
     brush.SetSize(size);
     brush.Draw(g, prevPoint, currentPoint);
     DrawBox.Invalidate();
 }
Example #3
0
        private void DrawWindow_Load(object sender, EventArgs e)
        {
            factoryCircle    = new Factory.ConcreteFactoryCircle();
            factoryRectangle = new Factory.ConcreteFactoryRectangle();

            MessageBox.Show(drawType);
            if (drawType == "Circle")
            {
                System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
                path.AddEllipse(0, 0, 231, 231);
                Region region = new Region(path);
                DrawBox.Region = region;

                g.SetClip(region, System.Drawing.Drawing2D.CombineMode.Replace);
                g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                g.Clear(Color.White);
            }
        }
Example #4
0
        private void InitCanvas(Factory.IAbstractFactory factory)
        {
            Canvas.ICanvas canvas = factory.CreateCanvas();
            DrawWindow     dw     = new DrawWindow();

            dw.drawType  = canvas.GetCanvasType();
            dw.DrawBox   = canvas.SetDrawBox(dw.DrawBox);
            dw.MdiParent = this;

            /*if (dw.drawType == "Circle")
             * {
             *  dw.iscircle = true;
             * }
             * else
             * {
             *  dw.iscircle = false;
             * }*/

            dw.Show();
        }