Control FontType() { var drawable = new Drawable { Size = new Size(40, 40) }; drawable.MouseUp += delegate { SelectFont(); }; drawable.Paint += delegate(object sender, PaintEventArgs pe) { if (canvas != null) { canvas.DrawRegion(pe.Graphics, new Rectangle(Point.Empty, canvas.WindowSize)); } }; drawable.LoadComplete += delegate // Shown? { if (drawable.Size.IsEmpty) { return; } canvas = new BGICanvas(drawable, drawable.Size); DrawCanvas(); }; return(drawable); }
Control Preview() { var size = new Size(128, 128); var drawable = new Drawable { Size = size }; drawable.Paint += (sender, pe) => { if (canvas != null) { canvas.DrawRegion(pe.Graphics, new Rectangle(size)); } }; drawable.LoadComplete += delegate { canvas = new BGICanvas(drawable, size); DrawCanvas(); }; var layout = new DynamicLayout(); layout.AddCentered(drawable, verticalCenter: false); return(new GroupBox { Text = "Preview", Content = layout }); }
Control Preview() { var size = new Size(128, 128); var drawable = new Drawable { Size = size }; drawable.Paint += (sender, pe) => { if (canvas != null) { canvas.DrawRegion(pe.Graphics, new Rectangle(size)); } }; drawable.LoadComplete += delegate { canvas = new BGICanvas(drawable, size); DrawCanvas(); }; return(new GroupBox { Text = "Preview", Content = drawable }); }
Control Preview() { var control = new Drawable { Size = new Size(400, 100) }; control.Paint += delegate(object sender, PaintEventArgs pe) { if (canvas != null) { canvas.DrawRegion(pe.Graphics, new Rectangle(canvas.WindowSize)); } }; control.LoadComplete += delegate { canvas = new BGICanvas(control, control.Size); DrawPreview(); }; return(control); }