-
Notifications
You must be signed in to change notification settings - Fork 18
/
Form1.cs
271 lines (230 loc) · 9.19 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
#region BSD License
/*
*
* Original BSD 3-Clause License (https://github.com/ComponentFactory/Krypton/blob/master/LICENSE)
* © Component Factory Pty Ltd, 2006 - 2016, (Version 4.5.0.0) All rights reserved.
*
* New BSD 3-Clause License (https://github.com/Krypton-Suite/Standard-Toolkit/blob/master/LICENSE)
* Modifications by Peter Wagner(aka Wagnerp) & Simon Coghlan(aka Smurf-IV), et al. 2017 - 2021. All rights reserved.
*
*/
#endregion
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Krypton.Toolkit;
namespace KryptonColorButtonExamples
{
public partial class Form1 : Form
{
public Form1() => InitializeComponent();
private void Form1_Load(object sender, EventArgs e) =>
// Setup the property grid to edit this color button
propertyGrid.SelectedObject = new KryptonColorButtonProxy(blueSplitter);
private void colorButtonEnter(object sender, EventArgs e) =>
// Setup the property grid to edit this color button
propertyGrid.SelectedObject = new KryptonColorButtonProxy(sender as KryptonColorButton);
private void buttonClose_Click(object sender, EventArgs e) => Close();
private void KryptonColorButton5_Click(object sender, EventArgs e)
{
if (KryptonMessageBox.Show(this,
@"Do you want to perform the normal colourButtonAction ?",
@"Launch what you want",
KryptonMessageBoxButtons.YesNo, KryptonMessageBoxIcon.Question) == DialogResult.Yes)
{
kryptonColorButton5.PerformDropDown();
}
}
private void blueRight_Click(object sender, EventArgs e)
{
blueRight.AddUpdateRecentColors(new[]
{
Color.Yellow,
Color.YellowGreen,
Color.GreenYellow,
Color.LightGoldenrodYellow,
Color.LightYellow,
Color.PaleGoldenrod,
Color.Gold,
Color.Goldenrod
});
blueRight.PerformDropDown();
}
}
public class KryptonColorButtonProxy
{
private KryptonColorButton _colorButton;
public KryptonColorButtonProxy(KryptonColorButton comboBox) => _colorButton = comboBox;
[Category("Appearance")]
[Description("Text for display inside the control.")]
public string Text
{
get => _colorButton.Text;
set => _colorButton.Text = value;
}
[Category("Layout")]
[Description("The size of the control is pixels.")]
public Size Size
{
get => _colorButton.Size;
set => _colorButton.Size = value;
}
[Category("Layout")]
[Description("The location of the control in pixels.")]
public Point Location
{
get => _colorButton.Location;
set => _colorButton.Location = value;
}
[Category("Behavior")]
[Description("Determine the maximum number of recent colors to store and display.")]
public int MaxRecentColors
{
get => _colorButton.MaxRecentColors;
set => _colorButton.MaxRecentColors = value;
}
[Category("Behavior")]
[Description("Determine the visible state of the themes color set.")]
public bool VisibleThemes
{
get => _colorButton.VisibleThemes;
set => _colorButton.VisibleThemes = value;
}
[Category("Behavior")]
[Description("Determine the visible state of the standard color set.")]
public bool VisibleStandard
{
get => _colorButton.VisibleStandard;
set => _colorButton.VisibleStandard = value;
}
[Category("Behavior")]
[Description("Determine the visible state of the recent color set.")]
public bool VisibleRecent
{
get => _colorButton.VisibleRecent;
set => _colorButton.VisibleRecent = value;
}
[Category("Behavior")]
[Description("Determine if the 'No Color' menu item is used.")]
public bool VisibleNoColor
{
get => _colorButton.VisibleNoColor;
set => _colorButton.VisibleNoColor = value;
}
[Category("Behavior")]
[Description("Determine if the 'More Colors...' menu item is used.")]
public bool VisibleMoreColors
{
get => _colorButton.VisibleMoreColors;
set => _colorButton.VisibleMoreColors = value;
}
[Category("Behavior")]
[Description("Should recent colors be automatically updated.")]
public bool AutoRecentColors
{
get => _colorButton.AutoRecentColors;
set => _colorButton.AutoRecentColors = value;
}
[Category("Behavior")]
[Description("Color scheme to use for the themes color set.")]
public ColorScheme SchemeThemes
{
get => _colorButton.SchemeThemes;
set => _colorButton.SchemeThemes = value;
}
[Category("Behavior")]
[Description("Color scheme to use for the standard color set.")]
public ColorScheme SchemeStandard
{
get => _colorButton.SchemeStandard;
set => _colorButton.SchemeStandard = value;
}
[Category("Appearance")]
[Description("Selected color.")]
public Color SelectedColor
{
get => _colorButton.SelectedColor;
set => _colorButton.SelectedColor = value;
}
[Category("Appearance")]
[Description("Border color of selected block when selected color is empty.")]
public Color EmptyBorderColor
{
get => _colorButton.EmptyBorderColor;
set => _colorButton.EmptyBorderColor = value;
}
[Category("Appearance")]
[Description("Selected color drawing rectangle.")]
public Rectangle SelectedRect
{
get => _colorButton.SelectedRect;
set => _colorButton.SelectedRect = value;
}
[Category("Visuals")]
[Description("Context menu display strings.")]
public PaletteColorButtonStrings Strings => _colorButton.Strings;
[Category("Visuals")]
[Description("Visual orientation of the control.")]
public VisualOrientation ButtonOrientation
{
get => _colorButton.ButtonOrientation;
set => _colorButton.ButtonOrientation = value;
}
[Category("Visuals")]
[Description("Position of the drop arrow within the button.")]
public VisualOrientation DropDownPosition
{
get => _colorButton.DropDownPosition;
set => _colorButton.DropDownPosition = value;
}
[Category("Visuals")]
[Description("Orientation of the drop arrow within the button.")]
public VisualOrientation DropDownOrientation
{
get => _colorButton.DropDownOrientation;
set => _colorButton.DropDownOrientation = value;
}
[Category("Visuals")]
[Description("Determine if button acts as a splitter or just a drop down.")]
public bool Splitter
{
get => _colorButton.Splitter;
set => _colorButton.Splitter = value;
}
[Category("Visuals")]
[Description("Button style.")]
public ButtonStyle ButtonStyle
{
get => _colorButton.ButtonStyle;
set => _colorButton.ButtonStyle = value;
}
[Category("Visuals")]
[Description("Button values")]
public ColorButtonValues Values => _colorButton.Values;
[Category("Visuals")]
[Description("Image value overrides.")]
public DropDownButtonImages Images => _colorButton.Images;
[Category("Visuals")]
[Description("Overrides for defining common button appearance that other states can override.")]
public PaletteTripleRedirect StateCommon => _colorButton.StateCommon;
[Category("Visuals")]
[Description("Overrides for defining disabled button appearance.")]
public PaletteTriple StateDisabled => _colorButton.StateDisabled;
[Category("Visuals")]
[Description("Overrides for defining normal button appearance.")]
public PaletteTriple StateNormal => _colorButton.StateNormal;
[Category("Visuals")]
[Description("Overrides for defining hot tracking button appearance.")]
public PaletteTriple StateTracking => _colorButton.StateTracking;
[Category("Visuals")]
[Description("Overrides for defining pressed button appearance.")]
public PaletteTriple StatePressed => _colorButton.StatePressed;
[Category("Visuals")]
[Description("Overrides for defining normal button appearance when default.")]
public PaletteTripleRedirect OverrideDefault => _colorButton.OverrideDefault;
[Category("Visuals")]
[Description("Overrides for defining button appearance when it has focus.")]
public PaletteTripleRedirect OverrideFocus => _colorButton.OverrideFocus;
}
}