public static void Build(long i) { var picX = 111; var picY = 0; Bitmap padPic = GetImg(i); Bitmap lightsPic = Resources.pad_blinklights; var lcdPicPad = new LCDPicture { Location = new Point(picX, picY), Size = padPic.Size, Image = padPic, MergeMethod = MergeMethods.Transparent, }; var lcdPicLights = new LCDPicture { Location = new Point(picX, picY), Size = lightsPic.Size, Image = lightsPic, MergeMethod = MergeMethods.Transparent, }; var lcdPicEmpty = new LCDPicture { Location = new Point(picX, picY), Size = Resources.pad_empty.Size, Image = Resources.pad_empty, }; var txtTitle = new LCDLabel { Location = new Point(1, LCDApp.DefaultSize.Height / 4), Font = PixelFonts.Title, Text = "Docking Pad Display", AutoSize = true, }; var txtDescription = new LCDMarquee { Location = new Point(1, LCDApp.DefaultSize.Height / 2), Font = PixelFonts.Small, Text = "Blinking lights are the port side (red).", Size = new Size(108, 10), BreakAtEnd = false, }; var txtHide = new LCDLabel { Location = new Point(6/*11*/, LCDApp.DefaultSize.Height - 8), Font = PixelFonts.Small, Text = "[Hide]", AutoSize = true, }; var txtExit = new LCDLabel { Location = new Point(90, LCDApp.DefaultSize.Height - 8), Font = PixelFonts.Small, Text = "[Exit]", AutoSize = true, }; BlinkTab = new LCDTabPage(); BlinkTab.Controls.Add(lcdPicEmpty); BlinkTab.Controls.Add(lcdPicPad); BlinkTab.Controls.Add(lcdPicLights); BlinkTab.Controls.Add(txtTitle); BlinkTab.Controls.Add(txtDescription); BlinkTab.Controls.Add(txtHide); BlinkTab.Controls.Add(txtExit); PadTimer = new Timer { Interval = 500, Enabled = true }; PadTimer.Tick += (sender, args) => { if (lcdPicPad.Visible) { lcdPicPad.Hide(); lcdPicLights.Hide(); } else { lcdPicPad.Show(); lcdPicLights.Show(); } }; if (TabCtrl.TabPages.Contains(BlinkTab)) { App.PushToForeground(); return; }; TabCtrl.TabPages.Add(BlinkTab); TabCtrl.SelectedTab = BlinkTab; App.PushToForeground(); }
/// <summary> /// The main entry point for the application. /// </summary> private static void Main() { var f = new LCDApp("LCDApp", false, false, false); var label = new LCDLabel { Font = PixelFonts.Small, Size = f.Size, Text = "Align me!", TextAlign = ContentAlignment.BottomRight, }; // var label = new LCDLabel // { // Font = PixelFonts.Small, // Location = new Point(2, 2), // AutoSize = true, // Size = f.Size, // MergeMethod = MergeMethods.Transparent, // Text = "Push ze button." // }; var line = new LCDLine { Start = new Point(0, 0), End = new Point(f.Width - 1, f.Height - 1) }; var rectangle = new LCDRectangle { Location = new Point(0, 0), Size = new Size(40, 40), Style = RectangleStyle.Bordered }; var ellipse = new LCDEllipse { Location = new Point(40, 20), Size = new Size(50, 20) }; var progressBar = new LCDProgressBar { Location = new Point(12, 14), Size = new Size(136, 6), Style = BorderStyle.Border, Direction = ProgressBarDirection.Right, Value = 50 }; var picture = new LCDPicture { Location = new Point(100, 10), Size = Resources.gtech.Size, Image = Resources.gtech, MergeMethod = MergeMethods.Overlay }; var marq = new LCDMarquee { Text = "Lorem", Size = new Size(LCDApp.DefaultSize.Width, 10), Location = new Point(0, 10), }; var graph = new LCDSimpleGraph { Location = new Point(70, 30), Size = new Size(40, 10), Style = BorderStyle.Border }; (new Timer { Interval = 500, Enabled = true }).Tick += (sender, args) => { graph.PushValue(new Random().Next(0, 100)); }; var tabControl = new LCDTabControl(); var tabPage = new LCDTabPage { Icon = new LCDLabel { AutoSize = true, Text = "A", Font = PixelFonts.Title } }; var tabPage2 = new LCDTabPage { Icon = new LCDLabel { AutoSize = true, Text = "B", Font = PixelFonts.Title } }; tabPage.Controls.Add(label); tabPage.Controls.Add(line); tabPage.Controls.Add(marq); tabPage2.Controls.Add(rectangle); tabPage2.Controls.Add(ellipse); tabPage2.Controls.Add(progressBar); tabPage2.Controls.Add(picture); tabPage2.Controls.Add(graph); tabControl.TabPages.Add(tabPage); tabControl.TabPages.Add(tabPage2); tabControl.TabPages.Add(new LCDTabPage { Icon = new LCDLabel { AutoSize = true, Font = PixelFonts.Title, Text = "1" } }); tabControl.TabPages.Add(new LCDTabPage { Icon = new LCDLabel { AutoSize = true, Font = PixelFonts.Title, Text = "2" } }); tabControl.TabPages.Add(new LCDTabPage { Icon = new LCDLabel { AutoSize = true, Font = PixelFonts.Title, Text = "3" } }); tabControl.TabPages.Add(new LCDTabPage { Icon = new LCDLabel { AutoSize = true, Font = PixelFonts.Title, Text = "4" } }); tabControl.SelectedTab = tabPage; f.Controls.Add(tabControl); f.ButtonDown += (sender, args) => { if (args.Button == 2) { tabControl.ShowMenu(); } if (args.Button == 3) { f.Dispose(); } }; f.PushToForeground(); f.WaitForClose(); }