public DemoPage() : base(0, 0, DemoManager.Desktop.Width, DemoManager.Desktop.Height) { //Background = new SolidColorBrush(Color.CornflowerBlue) { Opacity = 256 }; Background = new LinearGradientBrush(Color.Bisque, Color.Black, 0, 0, 1000, 1000, 220); btnBack = new Button(0, 0, 70, 24, DemoManager.FontCourierNew10, "Back", Color.White) { BackgroundUnpressed = DemoManager.Bar }; btnBack.Click += btnBack_Click; Children.Add(btnBack); int y = btnBack.Height + 10; Content = new Panel(0, y, Width, Height - y); Children.Add(Content); }
public override void OnRender(DrawingContext dc) { if (isChecked) { if (backgroundChecked != null) dc.DrawRectangle(backgroundChecked, border, 0, 0, Width, Height); else { dc.DrawRectangle(backgroundUnchecked, border, 0, 0, Width, Height); int offset = 2; LinearGradientBrush b = new LinearGradientBrush(Color.LimeGreen, Color.Black); dc.DrawRectangle(b, null, offset, offset, Width - 2 * offset, Height - 2 * offset); } } else { dc.DrawRectangle(backgroundUnchecked, border, 0, 0, Width, Height); } }