コード例 #1
0
        public void CreateBorderedScrollableView()
        {
            TextView textView = new TextView();

            // TextView is a VisualComponent, which lets us put it into SetContents
            SetContents(textView);

            // But we want a bordered and scrollable TextView. So we decorate it accordingly
            // before calling the SetContents method.
            var scrollingTextView           = new ScrollDecorator(textView);
            var scrollingTextViewWithBorder = new BorderDecorator(scrollingTextView, 1);

            SetContents(scrollingTextViewWithBorder);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: jamclaub/Decoratorpractice
        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();
        }