@@ -10,6 +10,8 @@ public partial class ColorControl : UserControl
1010{
1111 public event EventHandler ColorChanged ;
1212
13+
14+ [ DefaultValue ( typeof ( FlowDirection ) , "LeftToRight" ) ]
1315 [ Category ( "Appearance property" ) ]
1416 public FlowDirection FlowDirection
1517 {
@@ -22,16 +24,20 @@ public FlowDirection FlowDirection
2224 }
2325 }
2426
27+ [ DefaultValue ( typeof ( Size ) , "24,24" ) ]
2528 [ Category ( "Appearance property" ) ]
2629 public Size BoxSize { get => pictureBox . Size ; set => pictureBox . Size = value ; }
2730
31+ [ DefaultValue ( "" ) ]
2832 [ Localizable ( true ) ]
2933 public string ToolTip { set => toolTip . SetToolTip ( pictureBox , value ) ; get => toolTip . GetToolTip ( pictureBox ) ; }
3034
35+ [ DefaultValue ( "" ) ]
3136 [ Category ( "Header/footer text" ) ]
3237 [ Localizable ( true ) ]
3338 public string HeaderText { set { labelHeader . Text = value ; labelHeader . Visible = value != "" ; } get => labelHeader . Text ; }
3439
40+ [ DefaultValue ( "" ) ]
3541 [ Category ( "Header/footer text" ) ]
3642 [ Localizable ( true ) ]
3743 public Font HeaderFont { set => labelHeader . Font = value ; get => labelHeader . Font ; }
@@ -44,6 +50,7 @@ public FlowDirection FlowDirection
4450 [ Localizable ( true ) ]
4551 public string FooterText { set { labelFooter . Text = value ; labelFooter . Visible = value != "" ; } get => labelFooter . Text ; }
4652
53+
4754 [ Localizable ( true ) ]
4855 [ Category ( "Header/footer text" ) ]
4956 public Font FooterFont { set => labelFooter . Font = value ; get => labelFooter . Font ; }
@@ -52,52 +59,68 @@ public FlowDirection FlowDirection
5259 [ Category ( "Header/footer text" ) ]
5360 public Padding FooterMargin { set => labelFooter . Margin = value ; get => labelFooter . Margin ; }
5461
62+
63+ [ DefaultValue ( false ) ]
64+ [ Category ( "Color" ) ]
65+ public bool Inversion { set ; get ; } = false ;
66+
5567 [ Category ( "Color" ) ]
56- public Color Color { set => pictureBox . BackColor = value ; get => pictureBox . BackColor ; }
68+ public Color Color
69+ {
70+ set => pictureBox . BackColor = value ;
71+ get {
72+ var color = pictureBox . BackColor ;
73+ return Inversion ? Color . FromArgb ( color . A , 255 - color . R , 255 - color . G , 255 - color . B ) : color ;
74+ }
75+ }
5776
5877 [ Category ( "Color" ) ]
59- public int Argb { set => pictureBox . BackColor = Color . FromArgb ( value ) ; get => pictureBox . BackColor . ToArgb ( ) ; }
78+ public int Argb
79+ {
80+ set => pictureBox . BackColor = Color . FromArgb ( value ) ;
81+ get => Color . ToArgb ( ) ;
82+ }
6083
6184 [ Category ( "Color" ) ]
6285 public int Red
6386 {
6487 set { if ( value >= 0 && value < 256 ) pictureBox . BackColor = Color . FromArgb ( value , pictureBox . BackColor . G , pictureBox . BackColor . B ) ; }
65- get { return pictureBox . BackColor . R ; }
88+ get => Inversion ? 255 - pictureBox . BackColor . R : pictureBox . BackColor . R ;
6689 }
6790
6891 [ Category ( "Color" ) ]
6992 public int Green
7093 {
7194 set { if ( value >= 0 && value < 256 ) pictureBox . BackColor = Color . FromArgb ( pictureBox . BackColor . R , value , pictureBox . BackColor . B ) ; }
72- get { return pictureBox . BackColor . G ; }
95+ get => Inversion ? 255 - pictureBox . BackColor . G : pictureBox . BackColor . G ;
7396 }
7497
7598 [ Category ( "Color" ) ]
7699 public int Blue
77100 {
78101 set { if ( value >= 0 && value < 256 ) pictureBox . BackColor = Color . FromArgb ( pictureBox . BackColor . R , pictureBox . BackColor . G , value ) ; }
79- get { return pictureBox . BackColor . B ; }
102+ get => Inversion ? 255 - pictureBox . BackColor . B : pictureBox . BackColor . B ;
80103 }
81104
82105 [ Category ( "Color" ) ]
83106 public float RedF
84107 {
85108 set { if ( value >= 0 && value <= 1 ) pictureBox . BackColor = Color . FromArgb ( ( int ) ( value * 255 ) , pictureBox . BackColor . G , pictureBox . BackColor . B ) ; }
86- get { return pictureBox . BackColor . R / 255f ; }
109+ get => Inversion ? 1 - pictureBox . BackColor . R / 255f : pictureBox . BackColor . R / 255f ;
87110 }
88111
89112 [ Category ( "Color" ) ]
90113 public float GreenF
91114 {
92115 set { if ( value >= 0 && value < 256 ) pictureBox . BackColor = Color . FromArgb ( pictureBox . BackColor . R , ( int ) ( value * 255 ) , pictureBox . BackColor . B ) ; }
93- get { return pictureBox . BackColor . G / 255f ; }
116+ get => Inversion ? 1 - pictureBox . BackColor . G / 255f : pictureBox . BackColor . G / 255f ;
94117 }
95118
96119 [ Category ( "Color" ) ]
97120 public float BlueF
98121 {
99122 set { if ( value >= 0 && value < 256 ) pictureBox . BackColor = Color . FromArgb ( pictureBox . BackColor . R , pictureBox . BackColor . G , ( int ) ( value * 255 ) ) ; }
100- get { return pictureBox . BackColor . B / 255f ; }
123+ get => Inversion ? 1 - pictureBox . BackColor . B / 255f : pictureBox . BackColor . B / 255f ;
101124 }
102125
103126 public ColorControl ( )
0 commit comments