//place the buttons on the window. private void SetupButtons() { Controls.Clear(); int x = 3; int y = 3; Color[] colors = mExtended ? this.mExtendedColors : this.mColors; this.mButtons = new ColorRadioButton[colors.Length]; int widht = ((colors.Length / mColorsPerRow) * 21) + 6 + 10; // Padding left/right for (int i = 0; i < colors.Length; i++) { if (i > 0 && i % mColorsPerRow == 0) { y += 20; x = 3; } mButtons[i] = new ColorRadioButton(colors[i], this.BackColor); mButtons[i].Location = new Point(x, y); mButtons[i].Click += new EventHandler(BtnClicked); if (mSelectedColor == colors[i]) { mButtons[i].Checked = true; } Controls.Add(mButtons[i]); x += 20; } this.ClientSize = new System.Drawing.Size(widht, y + 23); if (mMoreColorButton == false) { return; } mBtnMoreColor = new Button(); mBtnMoreColor.FlatStyle = System.Windows.Forms.FlatStyle.Popup; mBtnMoreColor.Text = "More Colors..."; mBtnMoreColor.Location = new Point(3, y + 20); mBtnMoreColor.ClientSize = new Size(mExtended ? 160 : 80, 24); mBtnMoreColor.Click += new EventHandler(OnMoreClicked); Controls.Add(mBtnMoreColor); }
//place the buttons on the window. private void SetupButtons() { Controls.Clear(); int x = 3; int y = 3; int breakCount = extended ? 8 : 4; Color[] colors = extended ? this.extendedColors : this.colors; this.buttons = new ColorRadioButton[colors.Length]; if (extended) { this.ClientSize = new System.Drawing.Size(166, 130); } else { this.ClientSize = new System.Drawing.Size(86, 110); } for (int i = 0; i < colors.Length; i++) { if (i > 0 && i % breakCount == 0) { y += 20; x = 3; } buttons[i] = new ColorRadioButton(colors[i], this.BackColor); buttons[i].Location = new Point(x, y); Controls.Add(buttons[i]); buttons[i].Click += new EventHandler(BtnClicked); if (selectedColor == colors[i]) { buttons[i].Checked = true; } x += 20; } moreColorsBtn = new Button(); moreColorsBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; moreColorsBtn.Text = "More Colors..."; moreColorsBtn.Location = new Point(3, y + 20); moreColorsBtn.ClientSize = new Size(extended ? 160 : 80, 24); moreColorsBtn.Click += new EventHandler(OnMoreClicked); Controls.Add(moreColorsBtn); }
//place the buttons on the window. private void SetupButtons() { Controls.Clear(); int x = 3; int y = 3; Color[] colors = extended ? this.extendedColors : this.colors; this.buttons = new ColorRadioButton[colors.Length]; int widht = ((colors.Length / colorsPerRow) * 20) + 6; // Padding left/right for (int i = 0; i < colors.Length; i++) { if (i > 0 && i % colorsPerRow == 0) { y += 20; x = 3; } buttons[i] = new ColorRadioButton(colors[i], this.BackColor); buttons[i].Location = new Point(x, y); Controls.Add(buttons[i]); buttons[i].Click += new EventHandler(BtnClicked); if (selectedColor == colors[i]) { buttons[i].Checked = true; } x += 20; } this.ClientSize = new System.Drawing.Size(widht, y + 23); /* * if( moreColorButton == false ) * return; * * moreColorsBtn = new Button(); * moreColorsBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; * moreColorsBtn.Text = "More Colors..."; * moreColorsBtn.Location = new Point( 3, y + 20 ); * moreColorsBtn.ClientSize = new Size( extended ? 160 : 80, 24 ); * moreColorsBtn.Click += new EventHandler( OnMoreClicked ); * Controls.Add( moreColorsBtn ); */ }
//place the buttons on the window. private void SetupButtons() { Controls.Clear(); int x = 3; int y = 3; int breakCount = this.columnsCount; Color[] colors = extended ? this.extendedColors : this.colors; this.buttons = new ColorRadioButton[colors.Length]; int maxX = 0; for (int i = 0; i < colors.Length; i++) { if (i > 0 && i % breakCount == 0) { y += this.buttonSize; x = 3; } buttons[i] = new ColorRadioButton(colors[i], this.BackColor, new Size(this.buttonSize, this.buttonSize), this.SelectedForeColorText, this.SelectedBackColorText); buttons[i].Location = new Point(x, y); Controls.Add(buttons[i]); buttons[i].Click += new EventHandler(DoColorBtnClicked); buttons[i].RightClick += new EventHandler(DoColorBtnRightClicked); if (selectedColor == colors[i]) { buttons[i].Checked = true; } x += this.buttonSize; maxX = Math.Max(x, maxX); } moreColorsBtn = new Button(); moreColorsBtn.Text = "More Colors ..."; moreColorsBtn.Location = new Point(3, y + this.buttonSize + 3); moreColorsBtn.Size = new Size(maxX - 3, moreColorsBtn.Size.Height); moreColorsBtn.Click += new EventHandler(DoMoreColorsClicked); Controls.Add(moreColorsBtn); this.SelectedColor = Color.Black; this.SelectedForeColor = Color.White; }
//place the buttons on the window. private void SetupButtons() { Controls.Clear(); int x = 3; int y = 3; Color[] colors = extended ? this.extendedColors : this.colors; this.buttons = new ColorRadioButton[ colors.Length ]; int widht = ( ( colors.Length / colorsPerRow ) * 20 ) + 6; // Padding left/right for( int i = 0; i < colors.Length; i++ ) { if( i > 0 && i % colorsPerRow == 0 ) { y += 20; x = 3; } buttons[ i ] = new ColorRadioButton( colors[ i ], this.BackColor ); buttons[ i ].Location = new Point( x, y ); Controls.Add( buttons[ i ] ); buttons[ i ].Click += new EventHandler( BtnClicked ); if( selectedColor == colors[ i ] ) { buttons[ i ].Checked = true; } x += 20; } this.ClientSize = new System.Drawing.Size( widht, y + 23 ); /* if( moreColorButton == false ) return; moreColorsBtn = new Button(); moreColorsBtn.FlatStyle = System.Windows.Forms.FlatStyle.Popup; moreColorsBtn.Text = "More Colors..."; moreColorsBtn.Location = new Point( 3, y + 20 ); moreColorsBtn.ClientSize = new Size( extended ? 160 : 80, 24 ); moreColorsBtn.Click += new EventHandler( OnMoreClicked ); Controls.Add( moreColorsBtn ); */ }