Esempio n. 1
0
 public ThingPropertyPages(Things.IThing T)
 {
     this.InitializeComponent();
     // Use the dummy page to get size deltas, then discard it
     this.DeltaW = this.Width - this.tabDummy.Width;
     this.DeltaH = this.Height - this.tabDummy.Height;
     this.tabPages.TabPages.Clear();
     this.tabDummy.Dispose();
     this.tabDummy = null;
     // Add pages as needed
     foreach (PropertyPages.IThing P in T.GetPropertyPages())
     {
         P.Left = 0;
         P.Top = 0;
         if (this.tabPages.TabPages.Count == 0)
         {
             // Resize to match the first page (even if not fixed-size)
             this.Width = P.Width + this.DeltaW;
             this.Height = P.Height + this.DeltaH;
         }
         if (!P.IsFixedSize)
         {
             P.Dock = DockStyle.Fill;
         }
         TabPage TP = new ThemedTabPage(P.TabName);
         TP.UseVisualStyleBackColor = true;
         TP.Controls.Add(P);
         TP.Tag = P;
         this.tabPages.TabPages.Add(TP);
     }
     this.AdjustSize();
 }
Esempio n. 2
0
            /// <summary>
            /// Initializes a new instance of the ColorPicker class with default settings
            /// </summary>
            public ColorPicker(ColorCellEditor editor)
            {
                if (editor == null)
                {
                    throw new ArgumentNullException("editor", "editor cannot be null");
                }

                this.editor = editor;

                this.webHeightSet = false;
                this.systemHeightSet = false;

                this.tabControl = new TabControl();
                this.customTabPage = new ThemedTabPage();
                this.palette = new ColorPalette(editor);
                this.webTabPage = new ThemedTabPage();
                this.webListBox = new ColorListBox();
                this.systemTabPage = new ThemedTabPage();
                this.systemListBox = new ColorListBox();
                this.tabControl.SuspendLayout();
                this.SuspendLayout();
                //
                // tabControl1
                //
                this.tabControl.Controls.Add(this.customTabPage);
                this.tabControl.Controls.Add(this.webTabPage);
                this.tabControl.Controls.Add(this.systemTabPage);
                this.tabControl.Location = new System.Drawing.Point(0, 0);
                this.tabControl.Name = "tabControl";
                this.tabControl.SelectedIndex = 0;
                this.tabControl.Size = new Size(this.DefaultSize.Width - 2, this.DefaultSize.Height - 2);
                this.tabControl.TabIndex = 0;
                this.tabControl.TabStop = false;
                this.tabControl.GotFocus += new EventHandler(tabControl_GotFocus);
                //
                // customTabPage
                //
                this.customTabPage.Location = new System.Drawing.Point(4, 22);
                this.customTabPage.Name = "customTabPage";
                this.customTabPage.Size = new System.Drawing.Size(192, 214);
                this.customTabPage.TabIndex = 0;
                this.customTabPage.Text = "Custom";
                this.customTabPage.Controls.Add(this.palette);
                //
                // palette
                //
                this.palette.Dock = DockStyle.Fill;
                this.palette.Picked += new EventHandler(this.OnPalettePick);
                this.palette.KeyPress += new KeyPressEventHandler(this.editor.OnKeyPress);
                //
                // webTabPage
                //
                this.webTabPage.Location = new System.Drawing.Point(4, 22);
                this.webTabPage.Name = "webTabPage";
                this.webTabPage.Size = new System.Drawing.Size(192, 214);
                this.webTabPage.TabIndex = 1;
                this.webTabPage.Text = "Web";
                this.webTabPage.Controls.Add(this.webListBox);
                //
                // webListBox
                //
                this.webListBox.DrawMode = DrawMode.OwnerDrawFixed;
                this.webListBox.BorderStyle = BorderStyle.FixedSingle;
                this.webListBox.IntegralHeight = false;
                this.webListBox.Sorted = false;
                this.webListBox.Dock = DockStyle.Fill;
                this.webListBox.Click += new EventHandler(OnListClick);
                this.webListBox.DrawItem += new DrawItemEventHandler(OnListDrawItem);
                this.webListBox.KeyDown += new KeyEventHandler(OnListKeyDown);
                this.webListBox.KeyPress += new KeyPressEventHandler(this.editor.OnKeyPress);
                //
                // systemTabPage
                //
                this.systemTabPage.Location = new System.Drawing.Point(4, 22);
                this.systemTabPage.Name = "systemTabPage";
                this.systemTabPage.Size = new System.Drawing.Size(192, 214);
                this.systemTabPage.TabIndex = 2;
                this.systemTabPage.Text = "System";
                this.systemTabPage.Controls.Add(this.systemListBox);
                //
                // systemListBox
                //
                this.systemListBox.DrawMode = DrawMode.OwnerDrawFixed;
                this.systemListBox.BorderStyle = BorderStyle.FixedSingle;
                this.systemListBox.IntegralHeight = false;
                this.systemListBox.Sorted = false;
                this.systemListBox.Dock = DockStyle.Fill;
                this.systemListBox.Click += new EventHandler(OnListClick);
                this.systemListBox.DrawItem += new DrawItemEventHandler(OnListDrawItem);
                this.systemListBox.KeyDown += new KeyEventHandler(OnListKeyDown);
                this.systemListBox.FontChanged += new EventHandler(OnFontChanged);
                this.systemListBox.KeyPress += new KeyPressEventHandler(this.editor.OnKeyPress);

                // for some reason Array.Sort craps out with the WebColorComparer,
                // so the WebColors property returns an array that is already sorted
                //Array.Sort(this.WebColors, new ColorCellEditor.ColorPicker.WebColorComparer());
                for (int i=0; i<this.WebColors.Length; i++)
                {
                    this.webListBox.Items.Add(this.WebColors[i]);
                }

                Array.Sort(this.SystemColors, new ColorCellEditor.ColorPicker.SystemColorComparer());
                for (int i=0; i<this.SystemColors.Length; i++)
                {
                    this.systemListBox.Items.Add(this.SystemColors[i]);
                }

                //
                // ColorPicker
                //
                this.Controls.Add(this.tabControl);
                this.Name = "ColorPicker";
                this.Size = this.DefaultSize;
                this.tabControl.ResumeLayout(false);
                this.ResumeLayout(false);

                this.AdjustListBoxItemHeight();
            }