示例#1
0
        private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
        {
            LocUp = e.Location;
            CheckCoordinates(LocUp, LocDown);
            IDrawable temp;

            switch (comboBoxSelectShape.SelectedItem.ToString())
            {
            case "Rectangle":
                temp = new Rect(TopLeft, FilledStatus, ActColor, BottomRight.X - TopLeft.X, BottomRight.Y - TopLeft.Y);
                temp.Draw(graph);
                bindingSourceActShapes.Add(temp);
                break;

            case "Carre":
                temp = new Square(TopLeft, FilledStatus, ActColor, BottomRight.X - TopLeft.X);
                temp.Draw(graph);
                bindingSourceActShapes.Add(temp);
                break;

            case "Circle":
                temp = new Circle(TopLeft, FilledStatus, ActColor, BottomRight.X - TopLeft.X);
                temp.Draw(graph);
                bindingSourceActShapes.Add(temp);
                break;

            case "Image":
                if (FileName != "openFileDialog1")
                {
                    temp = new MyImage(TopLeft, FileName);
                    temp.Draw(graph);
                    bindingSourceActShapes.Add(temp);
                }
                break;

            case "Complexshape":
                ComplexShapesList.ElementAt(bindingSourceComplexShapeList.Position).TopLeft = TopLeft;
                ComplexShapesList.ElementAt(bindingSourceComplexShapeList.Position).Draw(graph);
                break;
            }
        }
示例#2
0
        // image always load first without knowing that it will be used or not
        // slow in the first load our program, but fast in the first we draw an image
        private void UseNormalWay(Graphics graphics)
        {
            switch (cbbImageName.Text)
            {
            case "naruto":
                realImage1.Draw(graphics, new Point(0, 0));
                break;

            case "narutovssasuke":
                realImage2.Draw(graphics, new Point(0, 0));
                break;

            case "narutovshinata":
                realImage3.Draw(graphics, new Point(0, 0));
                break;

            case "naruto_kage_bushin_no_jutsu":
                realImage4.Draw(graphics, new Point(0, 0));
                break;

            default: break;
            }
        }