static void Main(string[] args)
        {
            var textView        = new TextView();
            var scrollDecorator = new ScrollDecorator(textView);

            scrollDecorator.Draw();
            scrollDecorator.ScrollTo();
        }
        static void Main(string[] args)
        {
            IVisualComponent textView    = new TextView();
            IVisualComponent borderCompt = new BorderDecorator(textView);
            IVisualComponent scrollCompt = new ScrollDecorator(borderCompt);

            scrollCompt.Draw();
        }
Exemple #3
0
        static void Main(string[] args)
        {
            VisualComponent view = new TextView();
            //用边框装饰界面
            Decorator border = new BorderDecorator(view);
            //用滚动条装饰界面
            Decorator scroll = new ScrollDecorator(border);

            //滚动时
            scroll.Draw();
            Console.ReadLine();
        }
Exemple #4
0
        public static void ExecuteScript()
        {
            Console.WriteLine(new string('_', 100));
            Console.WriteLine("DECORATOR\n\n");

            IVisualComponent visualComponent = new TextView();

            visualComponent.Draw();
            Console.WriteLine("\n\n\n");

            visualComponent = new BorderDecorator(visualComponent, 16);

            visualComponent.Draw();
            Console.WriteLine("\n\n\n");

            visualComponent = new ScrollDecorator(visualComponent, 10);

            visualComponent.Draw();
            Console.WriteLine("\n\n\n");
        }