示例#1
0
        static void Main(string[] args)
        {
            // create a text shape (subclass of Text View in referenced library)
            TextShape textShape = new TextShape(new Point { X = 1, Y = 1 }, new Point { X = 10, Y = 2 });

            // drawing editor (client)
            DrawingEditior editor = new DrawingEditior();
            editor.Shapes= new List<IShape>();
            editor.Shapes.Add(textShape);

            // manipulate them in some way
            editor.ManipulateShapes();
        }
示例#2
0
        static void Main(string[] args)
        {
            // create a seemingly incompatible TextView object
            TextView textView = new TextView(new Point { X = 1, Y = 1 }, new Point { X = 10, Y = 2 });

            // create a text shape (subclass of shape in this project)
            TextShape textShape = new TextShape(textView);

            // drawing editor (client)
            DrawingEditior editor = new DrawingEditior();
            editor.Shapes= new List<Shape>();
            editor.Shapes.Add(textShape);

            // manipulate them in some way
            editor.ManipulateShapes();
        }
示例#3
0
        static void Main(string[] args)
        {
            // create a text shape (subclass of Text View in referenced library)
            TextShape textShape = new TextShape(new Point {
                X = 1, Y = 1
            }, new Point {
                X = 10, Y = 2
            });

            // drawing editor (client)
            DrawingEditior editor = new DrawingEditior();

            editor.Shapes = new List <IShape>();
            editor.Shapes.Add(textShape);

            // manipulate them in some way
            editor.ManipulateShapes();
        }
示例#4
0
        static void Main(string[] args)
        {
            //Client
            Shape shape = new LineShape();

            shape.BoundIngBox();
            shape.CreateManipuator();

            Shape shape1 = new PolygonShape();

            shape1.BoundIngBox();
            shape1.CreateManipuator();

            //为了通过统一接口使用TextView,创建适配器(TextShape)
            Shape shape2 = new TextShape();

            shape2.BoundIngBox();
            shape2.CreateManipuator();

            Console.ReadKey();
        }
示例#5
0
        static void Main(string[] args)
        {
            // create a seemingly incompatible TextView object
            TextView textView = new TextView(new Point {
                X = 1, Y = 1
            }, new Point {
                X = 10, Y = 2
            });

            // create a text shape (subclass of shape in this project)
            TextShape textShape = new TextShape(textView);

            // drawing editor (client)
            DrawingEditior editor = new DrawingEditior();

            editor.Shapes = new List <Shape>();
            editor.Shapes.Add(textShape);

            // manipulate them in some way
            editor.ManipulateShapes();
        }