Beispiel #1
0
        public TestButtons()
        {
            theme = new ThemeStandard();
            ThemeableFormsInstance.Instance = theme;
            theme.LoadBaseThemes();
            theme.SetThemeByName("Elite EuroCaps");
            theme.FontName = "Microsoft Sans Serif";

            theme.FontSize     = 8.25f;
            theme.WindowsFrame = true;

            InitializeComponent();

            CompositeButton b = CompositeButton.QuickInit(Properties.Resources.Selector,
                                                          "B1 Dyn", new Font("Verdana", 8.25f), Color.Yellow, Color.Transparent,
                                                          Properties.Resources.edsm32x32, new Size(32, 32),
                                                          new Image[] { Properties.Resources.edlogo24, Properties.Resources.galaxy_black }, new Size(24, 24),
                                                          3,
                                                          (o, p) => { System.Diagnostics.Debug.WriteLine("CB " + o + " " + p); });

            this.Controls.Add(b);
            b.Location = new Point(250, 10);

            System.Diagnostics.Debug.WriteLine("Size needed " + b.FindMaxSubControlArea(0, 6));
            b.Size = new Size(128, b.FindMaxSubControlArea(0, 6).Height);

            b = CompositeButton.QuickInit(Properties.Resources.Selector,
                                          "B2 Dyn", new Font("Verdana", 8.25f), Color.Yellow, Color.Transparent,
                                          Properties.Resources.ScreenShot, new Size(24, 24),
                                          new Image[] { Properties.Resources.edlogo24, Properties.Resources.galaxy_black }, new Size(24, 24),
                                          3,
                                          (o, p) => { System.Diagnostics.Debug.WriteLine("CB " + o + " " + p); });
            b.Name = "Realistic";
            this.Controls.Add(b);
            b.Location = new Point(250, 120);
            b.Size     = new Size(128, b.FindMaxSubControlArea(0, 6).Height);

            theme.ApplyStd(this);
        }
Beispiel #2
0
        private void Redraw()
        {
            panelVScroll.SuspendLayout();

            panelVScroll.RemoveAllControls();

            // design for std 8.25 font sizes

            Bitmap backimage = new Bitmap(EDDiscovery.Icons.Controls.Selector);
            Color  centre = backimage.GetPixel(48, 48);
            Size   iconsize = new Size(24, 24);
            int    width = 96;
            int    padbot = 6, padbetween = 5;

            float brigthness = ExtendedControls.Theme.Current.Form.GetBrightness();
            Image selback    = brigthness < 0.3 ? EDDiscovery.Icons.Controls.Selector : EDDiscovery.Icons.Controls.Selector2;

            {
                Versions.VersioningManager mgr = new Versions.VersioningManager();
                AddOnManagerForm.ReadLocalFiles(mgr, true);

                int i = mgr.DownloadItems.Count;

                CompositeButton cb = CompositeButton.QuickInit(
                    selback,
                    (i == 0) ? "NO ADD ONS!".T(EDTx.UserControlPanelSelector_NOADDONS) : i.ToString() + " Add Ons".T(EDTx.UserControlPanelSelector_AddOns),
                    ExtendedControls.Theme.Current.GetFont,
                    (i == 0) ? Color.Red : (ExtendedControls.Theme.Current.TextBlockColor.GetBrightness() < 0.1 ? Color.AntiqueWhite : ExtendedControls.Theme.Current.TextBlockColor),
                    Color.Transparent,
                    EDDiscovery.Icons.Controls.ManageAddOns, iconsize,
                    new Image[] { EDDiscovery.Icons.Controls.ManageAddOns }, iconsize,
                    padbetween,
                    ButtonPress);

                panelVScroll.Controls.Add(cb);
                cb.Name = "Add on";
                cb.Tag  = null;
                toolTip.SetToolTip(cb.Buttons[0], "Click to add or remove Add Ons".T(EDTx.UserControlPanelSelector_TTA));
                toolTip.SetToolTip(cb.Decals[0], "Add ons are essential additions to your EDD experience!".T(EDTx.UserControlPanelSelector_TTB));

                ExtendedControls.Theme.Current.ApplyStd(cb);       // need to theme up the button
                cb.Size                 = new Size(width, cb.FindMaxSubControlArea(0, padbot).Height);
                cb.Label.BackColor      = cb.Decals[0].BackColor = Color.Transparent;
                cb.Buttons[0].BackColor = centre;   // but then fix the back colour again
            }

            PanelInformation.PanelIDs[] pids = PanelInformation.GetUserSelectablePanelIDs(EDDConfig.Instance.SortPanelsByName);

            for (int i = 0; i < pids.Length; i++)
            {
                PanelInformation.PanelInfo pi = PanelInformation.GetPanelInfoByPanelID(pids[i]);

                CompositeButton cb = CompositeButton.QuickInit(
                    selback,
                    pi.WindowTitle,
                    ExtendedControls.Theme.Current.GetFont,
                    ExtendedControls.Theme.Current.TextBlockColor.GetBrightness() < 0.1 ? Color.AntiqueWhite : ExtendedControls.Theme.Current.TextBlockColor,
                    Color.Transparent,
                    pi.TabIcon, iconsize,
                    new Image[] { EDDiscovery.Icons.Controls.Popout, EDDiscovery.Icons.Controls.AddTab }, iconsize,
                    padbetween,
                    ButtonPress);
                cb.SuspendLayout();
                panelVScroll.Controls.Add(cb);
                cb.Tag = pi.PopoutID;
                toolTip.SetToolTip(cb.Buttons[0], "Pop out in a new window".T(EDTx.UserControlPanelSelector_PP1));
                toolTip.SetToolTip(cb.Buttons[1], "Open as a new menu tab".T(EDTx.UserControlPanelSelector_MT1));
                toolTip.SetToolTip(cb.Decals[0], pi.Description);

                ExtendedControls.Theme.Current.ApplyStd(cb);
                cb.ResumeLayout();

                cb.Size                 = new Size(width, cb.FindMaxSubControlArea(0, padbot).Height);
                cb.Label.BackColor      = cb.Decals[0].BackColor = Color.Transparent;
                cb.Buttons[0].BackColor = centre; // need to reset the colour back!
                cb.Buttons[1].BackColor = centre; // need to reset the colour back!
            }

            panelVScroll.Scale(this.FindForm().CurrentAutoScaleFactor());
            Reposition();

            panelVScroll.ResumeLayout();
        }