Skip to content

Commit 4e0141a

Browse files
oops, fix last commit
1 parent 11a1175 commit 4e0141a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ConfigGUI/ColorPicker.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ public ColorPicker( string title, char oldColorCode ) {
5858
const int btnWidth = 130, btnHeight = 40, btnsPerCol = 8;
5959
int index = 0;
6060
void MakeButton( char colCode ) {
61-
int rows = index / btnsPerCol;
62-
if ((index % btnsPerCol) != 0) rows++; // round up
61+
int row = index / btnsPerCol, col = index % btnsPerCol;
6362
index++;
6463

6564
Button btn = new Button();
@@ -83,7 +82,9 @@ void MakeCancelButton() {
8382
bCancel.DialogResult = DialogResult.Cancel;
8483
bCancel.Font = new System.Drawing.Font( "Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0 );
8584

86-
int rows = 1 + (index / btnsPerCol);
85+
int rows = index / btnsPerCol;
86+
if ((index % btnsPerCol) != 0) rows++; // round up
87+
8788
int x = 0;
8889
// Centre if even count, align under row if odd count
8990
if ((rows & 1) == 0) {
@@ -105,7 +106,9 @@ void MakeCancelButton() {
105106
void MakeWindow(string title) {
106107
AutoScaleDimensions = new System.Drawing.SizeF( 8F, 13F );
107108
AutoScaleMode = AutoScaleMode.Font;
108-
int rows = 1 + (index / btnsPerCol);
109+
int rows = index / btnsPerCol;
110+
if ((index % btnsPerCol) != 0) rows++; // round up
111+
109112
ClientSize = new System.Drawing.Size( 18 + btnWidth * rows, 47 + btnHeight * btnsPerCol );
110113
Font = new System.Drawing.Font( "Lucida Console", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 0 );
111114
FormBorderStyle = FormBorderStyle.FixedDialog;

0 commit comments

Comments
 (0)