Exemplo n.º 1
0
        private void Panel_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
            for (i = 0; i < all_shapes.Length; i++)
            {
                if (!all_shapes[i].getSolid())
                {
                    pen.Width     = 1;
                    pen.Color     = all_shapes[i].getLineColor();
                    pen.DashStyle = DashStyle.Dot;
                }
                else
                {
                    pen.Width     = all_shapes[i].getThick();
                    pen.Color     = all_shapes[i].getLineColor();
                    pen.DashStyle = DashStyle.Solid;
                }

                if (all_shapes[i].GetType() == new MyPen().GetType())
                {
                    MyPen mypen = (MyPen)all_shapes[i];

                    e.Graphics.DrawLine(pen, mypen.getStart(), mypen.getFinish());
                    e.Graphics.FillEllipse(new SolidBrush(pen.Color), mypen.getStart().X, mypen.getStart().Y, 1, 1);
                }
                else if (all_shapes[i].GetType() == new MyLines().GetType())
                {
                    MyLines myline = (MyLines)all_shapes[i];

                    e.Graphics.DrawLine(pen, all_shapes[i].getStart(), all_shapes[i].getFinish());
                }
                else if (all_shapes[i].GetType() == new MyCircle().GetType())
                {
                    MyCircle mycircle = (MyCircle)all_shapes[i];

                    e.Graphics.DrawEllipse(pen, mycircle.getRectC());
                    if (mycircle.getFill())
                    {
                        sb.Color = mycircle.getColor();
                        e.Graphics.FillEllipse(sb, mycircle.getRectC());
                    }
                }
                else if (all_shapes[i].GetType() == new MyRect().GetType())
                {
                    MyRect myrect = (MyRect)all_shapes[i];

                    e.Graphics.DrawRectangle(pen, myrect.getRect());
                    if (myrect.getFill())
                    {
                        sb.Color = myrect.getColor();
                        e.Graphics.FillRectangle(sb, myrect.getRect());
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void SetupMine()
 {
     for (i = 0; i < 100; i++)
     {
         myrects[i]   = new winform_client.MyRect();
         mylines[i]   = new winform_client.MyLines();
         mycircles[i] = new winform_client.MyCircle();
     }
     for (i = 0; i < 3000; i++)
     {
         all_shapes[i] = new winform_client.All_Shapes();
         mypens[i]     = new winform_client.MyPen();
     }
 }
Exemplo n.º 3
0
 private void SetupMine()
 {
     for (i = 0; i < 100; i++)
     {
         myrects[i]   = new MyRect();
         mylines[i]   = new MyLines();
         mycircles[i] = new MyCircle();
     }
     for (i = 0; i < 3000; i++)
     {
         all_object[i] = new Object();
         pens[i]       = new MyPen();
     }
 }
Exemplo n.º 4
0
        private void Panel_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
            for (i = 0; i <= nobject; i++)
            {
                if (all_object[i].GetType() == new MyRect().GetType())
                {
                    MyRect myrect = (MyRect)all_object[i];
                    if (!myrect.getSolid())
                    {
                        pen.Width     = 1;
                        pen.Color     = myrect.getLineColor();
                        pen.DashStyle = DashStyle.Dot;
                    }
                    else
                    {
                        pen.Width     = myrect.getThick();
                        pen.Color     = myrect.getLineColor();
                        pen.DashStyle = DashStyle.Solid;
                    }

                    e.Graphics.DrawRectangle(pen, myrect.getRect());
                    if (myrect.getFill())
                    {
                        sb.Color = myrect.getColor();
                        e.Graphics.FillRectangle(sb, myrect.getRect());
                    }
                }
                else if (all_object[i].GetType() == new MyLines().GetType())
                {
                    MyLines myline = (MyLines)all_object[i];
                    if (!myline.getSolid())
                    {
                        pen.Width     = 1;
                        pen.Color     = myline.getLineColor();
                        pen.DashStyle = DashStyle.Dot;
                    }
                    else
                    {
                        pen.Width     = myline.getThick();
                        pen.Color     = myline.getLineColor();
                        pen.DashStyle = DashStyle.Solid;
                    }
                    e.Graphics.DrawLine(pen, myline.getPoint1(), myline.getPoint2());
                }
                else if (all_object[i].GetType() == new MyCircle().GetType())
                {
                    MyCircle mycircle = (MyCircle)all_object[i];
                    if (!mycircle.getSolid())
                    {
                        pen.Width     = 1;
                        pen.Color     = mycircle.getLineColor();
                        pen.DashStyle = DashStyle.Dot;
                    }
                    else
                    {
                        pen.Width     = mycircle.getThick();
                        pen.Color     = mycircle.getLineColor();
                        pen.DashStyle = DashStyle.Solid;
                    }
                    e.Graphics.DrawEllipse(pen, mycircle.getRectC());
                    if (mycircle.getFill())
                    {
                        sb.Color = mycircle.getColor();
                        e.Graphics.FillEllipse(sb, mycircle.getRectC());
                    }
                }
                else if (all_object[i].GetType() == new MyPen().GetType())
                {
                    MyPen mypen = (MyPen)all_object[i];
                    if (!mypen.getSolid())
                    {
                        pen.Width     = 1;
                        pen.Color     = mypen.getLineColor();
                        pen.DashStyle = DashStyle.Dot;
                    }
                    else
                    {
                        pen.Width     = mypen.getThick();
                        pen.Color     = mypen.getLineColor();
                        pen.DashStyle = DashStyle.Solid;
                    }
                    e.Graphics.DrawLine(pen, mypen.getOld(), mypen.getCurrent());
                    e.Graphics.FillEllipse(new SolidBrush(pen.Color), mypen.getOld().X - 6, mypen.getOld().Y - 6, 1, 1);
                }
            }

            pen.Width     = thick;
            pen.DashStyle = DashStyle.Solid;
            graphics      = e.Graphics;
        }
Exemplo n.º 5
0
        private void panel_MouseWheel(object sender, MouseEventArgs e)
        {
            if (hand == true)
            {
                lines = e.Delta * SystemInformation.MouseWheelScrollLines / 120;

                if (lines > 0)
                {
                    ratio *= 0.9F;
                    if (ratio < 1)
                    {
                        ratio = 1;
                    }
                    wheel_line--;
                    if (wheel_line <= 0)
                    {
                        wheel_line = 0;
                    }
                }
                else if (lines < 0)
                {
                    ratio *= 1.1F;
                    if (ratio > 100.0)
                    {
                        ratio = 100.0;
                    }
                    wheel_line++;
                    if (wheel_line > 5)
                    {
                        wheel_line = 4;
                    }
                }

                for (i = 0; i < all_shapes.Length; i++)
                {
                    if (all_shapes[i].GetType() == new MyRect().GetType())
                    {
                        MyRect myrect = (MyRect)all_shapes[i];
                        myrect.setSize(lines, wheel_line);
                        AppendText(txt_chat, wheel_line.ToString());
                    }
                    else if (all_shapes[i].GetType() == new MyLines().GetType())
                    {
                        MyLines myline = (MyLines)all_shapes[i];
                        myline.setSize(lines, wheel_line);
                    }
                    else if (all_shapes[i].GetType() == new MyCircle().GetType())
                    {
                        MyCircle mycircle = (MyCircle)all_shapes[i];
                        mycircle.setSize(lines, wheel_line);
                        AppendText(txt_chat, mycircle.getThick().ToString());
                    }
                    else if (all_shapes[i].GetType() == new MyPen().GetType())
                    {
                        MyPen mypen = (MyPen)all_shapes[i];
                        mypen.setSize(lines, wheel_line);
                    }
                }

                panel.Invalidate(true);
            }
        }