public SliderDemo() : base(0, 0, 0, 0) { //Slider sldr; Children.Add(new Slider(20, 20, 150, 30, 15, Orientation.Horizontal) { Value = 80, Background = new ImageBrush(Program.GetBitmap(Resources.BinaryResources.Bar, Bitmap.BitmapImageType.Bmp)), Foreground = new LinearGradientBrush(Color.LightGray, Color.Black) { Opacity = 50 } }); Children.Add(new Slider(20, 60, 30, 150, 12, Orientation.Vertical) { Value = 70, Background = new SolidColorBrush(Color.CornflowerBlue) { Opacity = 100 } }); Slider slider = new Slider(250, 20, 150, 32, 32, Orientation.Horizontal) { Value = 80, Background = new ImageBrush(Program.GetBitmap(Resources.BinaryResources.Bar, Bitmap.BitmapImageType.Bmp)), //Foreground = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.Logo)) { Opacity = 200 }, Foreground = new ImageBrush(Program.GetBitmap(Resources.BinaryResources.PowerOn, Bitmap.BitmapImageType.Gif)) { Opacity = 200 }, ThumbBorder = null }; Children.Add(slider); //Label lbl = new Label(250, 100, font, slider.Value.ToString()) { ForeColor = Color.White }; //Children.Add(lbl); //slider.ValueChanged += delegate(object sender, ValueChangedEventArgs e) { lbl.Text = e.Value.ToString(); }; Children.Add(new Slider(250, 100, 150, 30, 15, Orientation.Horizontal) { Value = 30, Background = new LinearGradientBrush(Color.LimeGreen, Color.Blue) { Opacity = 150 }, Foreground = new LinearGradientBrush(Color.Red, Color.CornflowerBlue) { Opacity = 150 }, ThumbBorder = new Pen(Color.Green, 1) }); }
public void QuickDemo() { //CheckCalibration(); Desktop.SuspendLayout(); ImageBrush brush = new ImageBrush(GetBitmap(Resources.BinaryResources.reWalls, Bitmap.BitmapImageType.Jpeg)); brush.Stretch = Stretch.Fill; Desktop.Background = brush; ImageBrush bar = new ImageBrush(GetBitmap(Resources.BinaryResources.Bar, Bitmap.BitmapImageType.Bmp)); int statusbarHeight = 24; Panel statusbar = new Panel(0, Desktop.Height - statusbarHeight, Desktop.Width, statusbarHeight); statusbar.Background = bar; Desktop.Children.Add(statusbar); Label lblClock = new Label(statusbar.Width - 50, 4, FontRegular, "00:00:00"); lblClock.ForeColor = Color.White; statusbar.Children.Add(lblClock); Level lvl2 = new Level(statusbar.Width - 100, 7, 40, 10, Orientation.Horizontal, 10) { Foreground = new LinearGradientBrush(Color.LimeGreen, Color.Black), Value = 0 }; statusbar.Children.Add(lvl2); Image img; int size = 100; Bitmap bmp = GetBitmap(Resources.BinaryResources.Operation, Bitmap.BitmapImageType.Gif); //img = new Image(20, 10, size, size, bmp); //desktop.Children.Add(img); //img = new Image(150, 10, size + 100, size, bmp); //desktop.Children.Add(img); //img = new Image(20, 150, size, size, bmp) { Border = new Pen(Color.Red, 2) }; //desktop.Children.Add(img); //img = new Image(150, 150, size, size, bmp) { Opacity = 80 }; //desktop.Children.Add(img); img = new Image(20, 20, size, size, bmp) { Opacity = 210, Background = new LinearGradientBrush(Color.LimeGreen, Color.CornflowerBlue) { Opacity = 180 } }; Desktop.Children.Add(img); Slider sl = new Slider(160, 20, 30, 100, 12, Orientation.Vertical) { Value = 0, //Background = new SolidColorBrush(Color.CornflowerBlue) { Opacity = 100 } Background = bar, }; Desktop.Children.Add(sl); Level lvl = new Level(20, 150, 30, 60, Orientation.Vertical, 10) { Value = 0, Background = new LinearGradientBrush(Color.LimeGreen, Color.CornflowerBlue) { Opacity = 180 }, Foreground = new LinearGradientBrush(Color.Blue, Color.Red) { Opacity = 210 } }; Desktop.Children.Add(lvl); Desktop.Children.Add(new Button(120, 170, 90, 24, FontRegular, "Click me", Color.White) { BackgroundUnpressed = bar }); Desktop.ResumeLayout(); new Thread(() => { int v = 0; string hour; string minute; string second; while (true) { Desktop.SuspendLayout(); //DateTime dt = RealTimeClock.GetTime(); DateTime dt = DateTime.Now; hour = (dt.Hour < 10) ? "0" + dt.Hour.ToString() : dt.Hour.ToString(); minute = (dt.Minute < 10) ? "0" + dt.Minute.ToString() : dt.Minute.ToString(); second = (dt.Second < 10) ? "0" + dt.Second.ToString() : dt.Second.ToString(); lblClock.Text = hour + ":" + minute + ":" + second; v += 10; if (v > 100) v = 0; lvl.Value = v; //pg.Value = v; lvl2.Value = v; sl.Value = v; Color temp = ((LinearGradientBrush)img.Background).StartColor; ((LinearGradientBrush)img.Background).StartColor = ((LinearGradientBrush)img.Background).EndColor; ((LinearGradientBrush)img.Background).EndColor = temp; Desktop.ResumeLayout(); //Thread.Sleep(200); } }).Start(); }