Пример #1
0
        internal static void Main(string[] args)
        {
            IWidget widget = new BorderDecorator(new ScrollDecorator(new TextField(10.1, 12.1)));

            widget.Draw();
            Console.Read();
        }
Пример #2
0
        public void DecoratorTest()
        {
            IWidget widget = new BorderDecorator(
                new BorderDecorator(
                    new Button(200, 70)));

            widget.Draw();
        }
Пример #3
0
    public static void UnitTest()
    {
        OpenGL theOpenGL = new OpenGL();

        Sphere theSphere = new Sphere();

        theSphere.SetRenderEngine(theOpenGL);

        BorderDecorator theSphereWithBorder = new BorderDecorator(theSphere);

        theSphereWithBorder.SetRenderEngine(theOpenGL);
        theSphereWithBorder.Draw();
    }
Пример #4
0
        static void Main(string[] args)
        {
            TextField       TXTfield     = new TextField(2, 5);
            ScrollDecorator newscrolly   = new ScrollDecorator(TXTfield);
            ScrollDecorator otherscrolly = new ScrollDecorator(newscrolly);
            BorderDecorator newBorder    = new BorderDecorator(otherscrolly);
            BorderDecorator otherBorder  = new BorderDecorator(newBorder);

            TXTfield.Draw();
            otherBorder.Draw();


            Console.ReadKey();
        }
Пример #5
0
    //
    void UnitTest_Shape()
    {
        OpenGL theOpenGL = new OpenGL();

        // 圓型
        Sphere theSphere = new Sphere();

        theSphere.SetRenderEngine(theOpenGL);

        //在圖型加外框
        BorderDecorator theSphereWithBorder = new BorderDecorator(theSphere);

        theSphereWithBorder.SetRenderEngine(theOpenGL);
        theSphereWithBorder.Draw();
    }
Пример #6
0
        public void Main()
        {
            IWindow usefulWindow = new BorderDecorator(
                new HorizontalScrollBarDecorator(
                    new VerticalScrollBarDecorator(
                        new Window())));

            usefulWindow.Draw();

            //Or you can add some syntaxic sugar:

            IWindow sugarWindow = new Window()
                                  .DecorateWith(new VerticalScrollBarDecorator())
                                  .DecorateWith(new HorizontalScrollBarDecorator())
                                  .DecorateWith(new BorderDecorator());

            sugarWindow.Draw();
        }