コード例 #1
0
        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();
        }