public LevelDemo() : base(0, 0, 0, 0) { Level lvl; lvl = new Level(20, 20, 50, 30) { Value = 60 }; Children.Add(lvl); lvl = new Level(80, 20, 100, 60) { Value = 60 }; Children.Add(lvl); lvl = new Level(200, 20, 50, 30, Orientation.Horizontal, 10) { Value = 60 }; Children.Add(lvl); lvl = new Level(20, 100, 30, 50, Orientation.Vertical, 10) { Value = 60 }; Children.Add(lvl); lvl = new Level(80, 100, 60, 30, Orientation.Horizontal, 10) { Value = 60, Background = new LinearGradientBrush(Color.LimeGreen, Color.CornflowerBlue) { Opacity = 120 }, Foreground = new LinearGradientBrush(Color.Blue, Color.Red) { Opacity = 150 } }; Children.Add(lvl); lvl = new Level(20, 200, 100, 30, Orientation.Horizontal, 30) { Value = 60, Background = new LinearGradientBrush(Color.LimeGreen, Color.CornflowerBlue), Foreground = new LinearGradientBrush(Color.Blue, Color.Red) }; Children.Add(lvl); new Thread(delegate() { int v = 0; while (true) { v += 5; if (v > 100) v = 0; foreach (Level l in Children) l.Value = v; Thread.Sleep(500); } }).Start(); }
public static void Demo1() { GraphicsManager gm = new GraphicsManager(800, 480); Desktop desktop = gm.Desktop; int k = desktop.Height / 240; Font font = Resources.GetFont(Resources.FontResources.CourierNew_10); desktop.SuspendLayout(); ImageBrush brush = new ImageBrush(GetBitmap(Resources.BinaryResources.Background_800_600, Bitmap.BitmapImageType.Jpeg)); brush.Stretch = Stretch.Fill; desktop.Background = brush; int statusbarHeight = 24; Panel statusbar = new Panel(0, desktop.Height - statusbarHeight, desktop.Width, statusbarHeight); statusbar.Background = new ImageBrush(GetBitmap(Resources.BinaryResources.Bar, Bitmap.BitmapImageType.Bmp)); desktop.Children.Add(statusbar); Label lblClock = new Label(statusbar.Width - 70, 4, font, "00:00:00"); lblClock.ForeColor = Color.White; statusbar.Children.Add(lblClock); Level lvl2 = new Level(statusbar.Width - 120, 7, 40, 10, Orientation.Horizontal, 10); lvl2.Foreground = new LinearGradientBrush(Color.LimeGreen, Color.Black); lvl2.Value = 50; statusbar.Children.Add(lvl2); statusbar.Children.Add(new Image(statusbar.Width - 160, 1, 23, 23, GetBitmap(Resources.BinaryResources.Drive, Bitmap.BitmapImageType.Gif))); statusbar.Children.Add(new Image(statusbar.Width - 185, 1, 23, 23, GetBitmap(Resources.BinaryResources.Mouse, Bitmap.BitmapImageType.Gif))); statusbar.Children.Add(new Image(statusbar.Width - 210, 1, 23, 23, GetBitmap(Resources.BinaryResources.Keyboard, Bitmap.BitmapImageType.Gif))); ////ToolButton btnHome = new ToolButton(10, 0, 70, statusbar.Height); //Button btnHome = new Button(10, 0, 70, statusbar.Height, null, "", Color.Black); //btnHome.Foreground = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.Home)); //btnHome.Border = null; ////btnHome.Enabled = false; //statusbar.Children.Add(btnHome); //------------------------------- //desktop.Children.Add(new Checkbox(20*k, 20*k, 20*k, 20*k)); desktop.Children.Add(new Checkbox(20, 20, 20, 20)); //return; desktop.Children.Add(new TextBlock(50, 10, 100, 100, font, "Hello world! I'm a text block. I'm very cool!") { ForeColor = Color.White, Background = new LinearGradientBrush(Color.Aquamarine, Color.Yellow) { Opacity = 70 }, TextAlignment = TextAlignment.Center, TextVerticalAlignment = VerticalAlignment.Top, TextWrap = true }); // Level lvl = new Level(20, 40, 60, 20, Orientation.Horizontal, 10); // lvl.Foreground = new LinearGradientBrush(Color.Blue, Color.Black); // //lvl.Value = 0; // Children.Add(lvl); ProgressBar pg = new ProgressBar(20, 80, 100, 10); pg.Foreground = new LinearGradientBrush(Color.LimeGreen, Color.Red); //pg.Foreground.Opacity = 220; desktop.Children.Add(pg); // Panel pnl = new Panel(20, 100, 100, 100); // pnl.Background = new LinearGradientBrush(Color.Blue, Color.LimeGreen); // //pnl.Background.Opacity = 80; // Children.Add(pnl); // Button btn = new Button(20, 220, 80, 30, font, "<", Color.White); // Children.Add(btn); // Button btn2 = new Button(60, 0, 80, 25, font, "Button 2 wwwwwwww", Color.White) // { // //BackgroundUnpressed = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.ButtonBackground)) { Opacity = 100 }; // //BackgroundPressed = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.ButtonBackground)) { Opacity = 220 }; // }; // btn2.Click += delegate(object sender, EventArgs e) // { // wndModal dlg = new wndModal(0, 0, 0, 0); // dlg.ShowModal(); // int a = 0; // int b = a; // //Close(); // }; // statusbar.Children.Add(btn2); // RadioButtonGroup rbg = new RadioButtonGroup(20, 260, 25, 70); // rbg.Background = new LinearGradientBrush(Color.White, Color.DarkGray); // //rbg.Background.Opacity = 120; // rbg.AddRadioButton(new RadioButton(5, 5, 15, true)); // rbg.AddRadioButton(new RadioButton(5, 25, 15)); // rbg.AddRadioButton(new RadioButton(5, 45, 15)); // Children.Add(rbg); // ToolButton tbtn; // tbtn = new ToolButton(300, 150, 128, 128); // //tbtn.BackgroundUnpressed = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.ButtonBackground)) { Opacity = 100 }; // //tbtn.BackgroundPressed = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.ButtonBackground)) { Opacity = 220 }; // tbtn.Foreground = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.Database)); // tbtn.Foreground.Opacity = 200; // Children.Add(tbtn); // tbtn = new ToolButton(450, 150, 128, 128); // tbtn.Foreground = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.Operation)); // tbtn.Foreground.Opacity = 200; // Children.Add(tbtn); // tbtn = new ToolButton(600, 150, 128, 128); // tbtn.Foreground = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.Settings)); // tbtn.Foreground.Opacity = 200; // Children.Add(tbtn); desktop.Children.Add(new Slider(250, 20, 150, 30, 15, Orientation.Horizontal) { Value = 80, Background = new ImageBrush(GetBitmap(Resources.BinaryResources.Bar, Bitmap.BitmapImageType.Bmp)), Foreground = new LinearGradientBrush(Color.LightGray, Color.Black) { Opacity = 50 } }); desktop.Children.Add(new Slider(200, 20, 30, 150, 12, Orientation.Vertical) { Value = 70, Background = new SolidColorBrush(Color.White) { Opacity = 100 } }); // Slider slider = new Slider(250, 60, 150, 30, 30, Orientation.Horizontal) // { // Value = 80, // Background = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.Bar)), // Foreground = new ImageBrush(Resources.GetBitmap(Resources.BitmapResources.GHILogo)) { Opacity = 200 }, // }; // 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(); }; new Thread(delegate() { int v = 0; while (true) { desktop.SuspendLayout(); DateTime dt = DateTime.Now; string hour = (dt.Hour < 10) ? "0" + dt.Hour.ToString() : dt.Hour.ToString(); string minute = (dt.Minute < 10) ? "0" + dt.Minute.ToString() : dt.Minute.ToString(); string second = (dt.Second < 10) ? "0" + dt.Second.ToString() : dt.Second.ToString(); string result = hour + ":" + minute + ":" + second; lblClock.Text = result; v += 10; if (v > 100) v = 0; //lvl.Value = v; pg.Value = v; lvl2.Value = v; //Color temp = ((LinearGradientBrush)pnl.Background).StartColor; //((LinearGradientBrush)pnl.Background).StartColor = ((LinearGradientBrush)pnl.Background).EndColor; //((LinearGradientBrush)pnl.Background).EndColor = temp; //pnl.Invalidate(); desktop.ResumeLayout(); Thread.Sleep(500); } }).Start(); //wndModal wndModal = new wndModal(); //wndModal.Show(); desktop.ResumeLayout(); }
private Control InitBoosterUIBlock(ref int x, out MultiImage miconBoosterState, out Label lblBoosterCurrent, out Level lvlBoosterCurrent) { Panel panelBooster = new Panel(x, 0, 30, 32); miconBoosterState = new MultiImage(9, 0, 12, 12); miconBoosterState["LedGray"] = new ImageBrush(Program.ImageLedGray); miconBoosterState["LedGreen"] = new ImageBrush(Program.ImageLedGreen); miconBoosterState["LedRed"] = new ImageBrush(Program.ImageLedRed); miconBoosterState.ActiveBrushID = "LedGray"; panelBooster.Children.Add(miconBoosterState); lvlBoosterCurrent = new Level(0, 13, 30, 10, Orientation.Horizontal, 10); lvlBoosterCurrent.Foreground = new LinearGradientBrush(Color.LimeGreen, Color.Black); panelBooster.Children.Add(lvlBoosterCurrent); lblBoosterCurrent = new Label(0, 24, Program.FontRegular, "0000 mA") { ForeColor = Program.LabelTextColor };//, Program.LabelTextColor); //lblBoosterCurrent.Width = 45; //panelBooster.Children.Add(lblBoosterCurrent); x += 30 + 8; return panelBooster; }
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(); }
public void Demo22() { display = new Display_SP22(1); gm = new GraphicsManager(240, 320); gm.OnRender += delegate(Bitmap bitmap, Rect dirtyArea) { display.SimpleGraphics.DisplayImage(bitmap, (uint)dirtyArea.X, (uint)dirtyArea.Y, (uint)dirtyArea.X, (uint)dirtyArea.Y, (uint)dirtyArea.Width, (uint)dirtyArea.Height); }; desktop.SuspendLayout(); ImageBrush brush = new ImageBrush(Program.GetBitmap(Resources.BinaryResources.reWalls, Bitmap.BitmapImageType.Jpeg)); brush.Stretch = Stretch.Fill; //desktop.Background = brush; int statusbarHeight = 24; Panel statusbar = new Panel(0, desktop.Height - statusbarHeight, desktop.Width, statusbarHeight); statusbar.Background = new ImageBrush(new Bitmap(Resources.GetBytes(Resources.BinaryResources.Bar), Bitmap.BitmapImageType.Bmp)); desktop.Children.Add(statusbar); Label lblClock = new Label(statusbar.Width - 70, 4, fontRegular, "00:00:00"); lblClock.ForeColor = Color.White; statusbar.Children.Add(lblClock); Level lvl2 = new Level(statusbar.Width - 120, 7, 40, 10, Orientation.Horizontal, 10); lvl2.Foreground = new LinearGradientBrush(Color.LimeGreen, Color.Black); lvl2.Value = 50; statusbar.Children.Add(lvl2); desktop.ResumeLayout(); new Thread(() => { int v = 0; while (true) { desktop.SuspendLayout(); DateTime dt = DateTime.Now; string hour = (dt.Hour < 10) ? "0" + dt.Hour.ToString() : dt.Hour.ToString(); string minute = (dt.Minute < 10) ? "0" + dt.Minute.ToString() : dt.Minute.ToString(); string second = (dt.Second < 10) ? "0" + dt.Second.ToString() : dt.Second.ToString(); string result = hour + ":" + minute + ":" + second; lblClock.Text = result; v += 10; if (v > 100) v = 0; //lvl.Value = v; //pg.Value = v; lvl2.Value = v; //Color temp = ((LinearGradientBrush)pnl.Background).StartColor; //((LinearGradientBrush)pnl.Background).StartColor = ((LinearGradientBrush)pnl.Background).EndColor; //((LinearGradientBrush)pnl.Background).EndColor = temp; //pnl.Invalidate(); desktop.ResumeLayout(); Thread.Sleep(500); } }).Start(); }