/// <summary> /// 初始状况. /// </summary> private static void Test1() { // 使用抽象构件定义 ComponentUI component, componentSB; // 定义具体构件 component = new Window(); // 定义装饰后的构件 componentSB = new ScrollBarDecorator(component); // 显示. componentSB.Display(); }
static void Main(string[] args) { Component component = new Window(); Component componentSB = new ScrollBarDecorator(component); componentSB.Display(); Console.WriteLine(); Component componentBB = new BlackBorderDecorator(componentSB); componentBB.Display(); Console.ReadKey(); }