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(); }
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(); }