@@ -52,29 +52,33 @@ public ColorPicker( string title, char oldColorCode ) {
5252 StartPosition = FormStartPosition . CenterParent ;
5353
5454 SuspendLayout ( ) ;
55- for ( char code = '0' ; code <= '9' ; code ++ )
55+ for ( char code = '0' ; code <= '9' ; code ++ )
5656 MakeButton ( code ) ;
57- for ( char code = 'a' ; code <= 'f' ; code ++ )
57+ for ( char code = 'a' ; code <= 'f' ; code ++ )
5858 MakeButton ( code ) ;
59+ for ( int i = 0 ; i < Color . ExtColors . Length ; i ++ ) {
60+ if ( ! Color . ExtColors [ i ] . Undefined ) MakeButton ( Color . ExtColors [ i ] . Code ) ;
61+ }
5962 MakeCancelButton ( ) ;
6063 MakeWindow ( title ) ;
6164 ResumeLayout ( false ) ;
6265 }
6366
6467
6568 const int btnWidth = 130 , btnHeight = 40 ;
69+ int index = 0 ;
6670 void MakeButton ( char colCode ) {
67- int hex = Color . Hex ( colCode ) ;
68- int row = hex / 8 , col = hex % 8 ;
71+ int row = index / 8 , col = index % 8 ;
72+ index ++ ;
6973
7074 Button btn = new Button ( ) ;
7175 SysCol textCol ;
7276 btn . BackColor = LookupColor ( colCode , out textCol ) ;
7377 btn . ForeColor = textCol ;
7478 btn . Location = new System . Drawing . Point ( 9 + row * btnWidth , 7 + col * btnHeight ) ;
7579 btn . Size = new System . Drawing . Size ( btnWidth , btnHeight ) ;
76- btn . Name = "b" + hex ;
77- btn . TabIndex = hex ;
80+ btn . Name = "b" + index ;
81+ btn . TabIndex = index ;
7882 btn . Text = ColorName ( colCode ) + " - " + colCode ;
7983 btn . Click += delegate { ColorCode = colCode ; DialogResult = DialogResult . OK ; Close ( ) ; } ;
8084 btn . Margin = new Padding ( 0 ) ;
@@ -90,7 +94,7 @@ void MakeCancelButton() {
9094 bCancel . Location = new System . Drawing . Point ( 88 , 330 ) ;
9195 bCancel . Name = "bCancel" ;
9296 bCancel . Size = new System . Drawing . Size ( 100 , 25 ) ;
93- bCancel . TabIndex = 16 ;
97+ bCancel . TabIndex = 260 ;
9498 bCancel . Text = "Cancel" ;
9599 bCancel . UseVisualStyleBackColor = true ;
96100 Controls . Add ( bCancel ) ;
0 commit comments