internal static void Main(string[] args) { IWidget widget = new BorderDecorator(new ScrollDecorator(new TextField(10.1, 12.1))); widget.Draw(); Console.Read(); }
public void DecoratorTest() { IWidget widget = new BorderDecorator( new BorderDecorator( new Button(200, 70))); widget.Draw(); }
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(); }
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(); }
// void UnitTest_Shape() { OpenGL theOpenGL = new OpenGL(); // 圓型 Sphere theSphere = new Sphere(); theSphere.SetRenderEngine(theOpenGL); //在圖型加外框 BorderDecorator theSphereWithBorder = new BorderDecorator(theSphere); theSphereWithBorder.SetRenderEngine(theOpenGL); theSphereWithBorder.Draw(); }
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(); }