Skip to content

Commit 26348b9

Browse files
authored
1376 v100 extending krypton task dialog (#2534)
* 1376-V100-Extending-KryptonTaskDialog - Refactoring of property sub classes and made those event based leaving the logic in the parent class. - Fixed Header element alignment and label positioning - Added an optional image to the Content and Expander elements. - Some housekeeping * 1376-V100-Extending-KryptonTaskDialog - Refactoring of property sub classes and made those event based leaving the logic in the parent class. - Fixed Header element alignment and label positioning - Added an optional image to the Content and Expander elements. - Some housekeeping * 1376-V100-Extending-KryptonTaskDialog - All FlowLayoutPanels and TableLayoutPanels now have DoubleBuffering applied. - Experimental and testing properties have been removed. - Added images to the RichtTextBox element's ContextMenu. - Added the FreeWheeler element. - Some housekeeping & refactoring * 1376-V100-Extending-KryptonTaskDialog - All FlowLayoutPanels and TableLayoutPanels now have DoubleBuffering applied. - Experimental and testing properties have been removed. - Added images to the RichtTextBox element's ContextMenu. - Added the FreeWheeler element. - Some housekeeping & refactoring
1 parent bb5be62 commit 26348b9

20 files changed

+232
-156
lines changed

Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialog/Elements/KryptonTaskDialogElementCheckBox.cs

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,29 @@ public class KryptonTaskDialogElementCheckBox : KryptonTaskDialogElementSingleLi
2020
public KryptonTaskDialogElementCheckBox(KryptonTaskDialogDefaults taskDialogDefaults)
2121
: base(taskDialogDefaults, 1)
2222
{
23-
Panel.Width = Defaults.ClientWidth;
23+
SetupPanel();
24+
25+
LayoutDirty = true;
26+
}
2427

28+
#region Private
29+
private void SetupControls()
30+
{
2531
_checkBox = new();
2632
_checkBox.AutoSize = true;
27-
_checkBox.Padding = new Padding(Defaults.ComponentSpace, 0, 0, 0);
33+
_checkBox.Padding = new Padding( Defaults.ComponentSpace, 0, 0, 0 );
2834
_checkBox.Margin = Defaults.NullMargin;
2935
_checkBox.CheckState = CheckState.Unchecked;
36+
}
3037

31-
_tlp.Controls.Add(_checkBox, 0, 0);
38+
private void SetupPanel()
39+
{
40+
Panel.Width = Defaults.ClientWidth;
41+
SetupControls();
3242

33-
LayoutDirty = true;
43+
_tlp.Controls.Add( _checkBox, 0, 0 );
3444
}
35-
45+
#endregion
3646
#region Protected/Internal
3747
/// <inheritdoc/>
3848
protected override void OnSizeChanged(bool performLayout = false)

Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialog/Elements/KryptonTaskDialogElementComboBox.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,18 +202,22 @@ public override Color ForeColor
202202
#endregion
203203

204204
#region Private
205-
private void SetupPanel()
205+
private void SetupControls()
206206
{
207-
// the description that goes with the combobox
208207
_description.AutoSize = true;
209208
_description.Padding = Defaults.NullPadding;
210-
_description.Margin = new(0, 0, 0, Defaults.ComponentSpace);
209+
_description.Margin = new( 0, 0, 0, Defaults.ComponentSpace );
211210

212211
_comboBox.AutoSize = true;
213212
_comboBox.Padding = Defaults.NullPadding;
214213
_comboBox.Margin = Defaults.NullMargin;
215214
_comboBox.Width = 250;
216215
DropDownStyle = InternalComboBoxStyle.DropDownList;
216+
}
217+
218+
private void SetupPanel()
219+
{
220+
SetupControls();
217221

218222
// add the controls
219223
_tlp.Controls.Add(_description, 0, 0);
File renamed without changes.

Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialog/Elements/KryptonTaskDialogElementCommandLinkButtons.cs

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public partial class KryptonTaskDialogElementCommandLinkButtons : KryptonTaskDia
1919

2020
private readonly ObservableCollection<KryptonCommandLinkButton> _buttons;
2121
private readonly TableLayoutPanel _tlp;
22-
private readonly FlowLayoutPanelDoubleBuffered _flp;
22+
private readonly FlowLayoutPanel _flp;
2323
private readonly KryptonButton _btnFlowDirection;
2424
private bool _disposed;
2525
#endregion
@@ -172,10 +172,9 @@ private void SetButtonRoundedCorners(KryptonCommandLinkButton button)
172172
button.StateCommon.Border.Rounding = Defaults.GetCornerRouding(RoundedCorners);
173173
}
174174

175-
private void SetupPanel()
175+
private void SetupTableLayoutPanel()
176176
{
177-
Panel.Width = Defaults.ClientWidth;
178-
177+
_tlp.SetDoubleBuffered(true);
179178
_tlp.AutoSize = true;
180179
_tlp.Left = Defaults.PanelLeft;
181180
_tlp.AutoSizeMode = AutoSizeMode.GrowAndShrink;
@@ -185,37 +184,52 @@ private void SetupPanel()
185184
_tlp.Margin = Defaults.NullMargin;
186185
_tlp.BackColor = Color.Transparent;
187186

188-
_tlp.RowCount = 1;
187+
_tlp.RowCount = 1;
189188
_tlp.ColumnCount = 2;
190-
189+
191190
_tlp.RowStyles.Clear();
192191
_tlp.ColumnStyles.Clear();
193-
_tlp.RowStyles.Add(new RowStyle(SizeType.AutoSize));
194-
_tlp.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
195-
_tlp.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize));
196-
192+
_tlp.RowStyles.Add( new RowStyle( SizeType.AutoSize ) );
193+
_tlp.ColumnStyles.Add( new ColumnStyle( SizeType.AutoSize ) );
194+
_tlp.ColumnStyles.Add( new ColumnStyle( SizeType.AutoSize ) );
195+
}
197196

197+
private void SetupFlowLayoutPanel()
198+
{
198199
// Note: do not dock the flow layout panel as that changes the behaviour of the flow direction.
199200
_flp.AutoSize = true;
201+
_flp.SetDoubleBuffered( true );
200202
_flp.AutoSizeMode = AutoSizeMode.GrowAndShrink;
201203
_flp.Top = 0;
202204
_flp.Left = 0;
203205
_flp.Margin = Defaults.NullMargin;
204-
_flp.Padding = new Padding(0, Defaults.ComponentSpace, 0, 0);
206+
_flp.Padding = new Padding( 0, Defaults.ComponentSpace, 0, 0 );
205207
_flp.Width = Panel.Width - Defaults.PanelLeft - Defaults.PanelRight - 20;
206-
_flp.MaximumSize = new Size(_flp.Width, 0);
208+
_flp.MaximumSize = new Size( _flp.Width, 0 );
207209
_flp.BackColor = Color.Transparent;
210+
}
208211

212+
private void SetupControls()
213+
{
209214
_btnFlowDirection.AutoSize = true;
210215
_btnFlowDirection.AutoSizeMode = AutoSizeMode.GrowAndShrink;
211216
_btnFlowDirection.Size = Defaults.ButtonSize_24x75;
212217
_btnFlowDirection.MinimumSize = Defaults.ButtonSize_24x75;
213-
_btnFlowDirection.Margin = new Padding(0, Defaults.ComponentSpace + 2, Defaults.ComponentSpace, 0);
218+
_btnFlowDirection.Margin = new Padding( 0, Defaults.ComponentSpace + 2, Defaults.ComponentSpace, 0 );
214219
_btnFlowDirection.Text = _flp.FlowDirection.ToString();
215220
_btnFlowDirection.Orientation = VisualOrientation.Left;
216221
_btnFlowDirection.ButtonOrientation = VisualOrientation.Left;
217222
_btnFlowDirection.Visible = false;
218223
_btnFlowDirection.Click += OnBtnFlowDirectionClick;
224+
}
225+
226+
private void SetupPanel()
227+
{
228+
Panel.Width = Defaults.ClientWidth;
229+
230+
SetupTableLayoutPanel();
231+
SetupFlowLayoutPanel();
232+
SetupControls();
219233

220234
// Assemble the controls
221235
Panel.Controls.Add(_tlp);

Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialog/Elements/KryptonTaskDialogElementCommandLinkButtonsFlowLayoutPanelDoubleBuffered.cs

Lines changed: 0 additions & 38 deletions
This file was deleted.
File renamed without changes.

Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialog/Elements/KryptonTaskDialogElementContent.cs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public partial class KryptonTaskDialogElementContent : KryptonTaskDialogElementB
2424
#endregion
2525

2626
#region Identity
27-
public KryptonTaskDialogElementContent(KryptonTaskDialogDefaults taskDialogDefaults)
27+
public KryptonTaskDialogElementContent(KryptonTaskDialogDefaults taskDialogDefaults)
2828
: base(taskDialogDefaults)
2929
{
3030
_disposed = false;
@@ -48,18 +48,9 @@ public KryptonTaskDialogElementContent(KryptonTaskDialogDefaults taskDialogDefau
4848
#endregion
4949

5050
#region Private
51-
private void SetupPictureBox()
52-
{
53-
_pictureBox.Visible = false;
54-
_pictureBox.Margin = new Padding(0, 0, Defaults.ComponentSpace, 0);
55-
_pictureBox.Padding = Defaults.NullPadding;
56-
_pictureBox.BorderStyle = BorderStyle.None;
57-
_pictureBox.SizeMode = PictureBoxSizeMode.CenterImage;
58-
_pictureBox.Anchor = AnchorStyles.Top | AnchorStyles.Left;
59-
}
60-
6151
private void SetupTableLayoutPanel()
6252
{
53+
_tlp.SetDoubleBuffered(true);
6354
_tlp.Left = Defaults.PanelLeft;
6455
_tlp.Top = Defaults.PanelTop;
6556
_tlp.AutoSize = true;
@@ -83,6 +74,13 @@ private void SetupTableLayoutPanel()
8374

8475
private void SetupControls()
8576
{
77+
_pictureBox.Visible = false;
78+
_pictureBox.Margin = new Padding(0, 0, Defaults.ComponentSpace, 0);
79+
_pictureBox.Padding = Defaults.NullPadding;
80+
_pictureBox.BorderStyle = BorderStyle.None;
81+
_pictureBox.SizeMode = PictureBoxSizeMode.CenterImage;
82+
_pictureBox.Anchor = AnchorStyles.Top | AnchorStyles.Left;
83+
8684
_textBox.AutoSize = false;
8785
_textBox.Height = 100;
8886
_textBox.Padding = new Padding(0);
@@ -93,7 +91,6 @@ private void SetupControls()
9391

9492
private void SetupPanel()
9593
{
96-
SetupPictureBox();
9794
SetupControls();
9895
SetupTableLayoutPanel();
9996

Source/Krypton Components/Krypton.Toolkit/Controls Toolkit/KryptonTaskDialog/Elements/KryptonTaskDialogElementContentTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public KryptonTaskDialogElementContentTest(KryptonTaskDialogDefaults taskDialogD
4040
Size = new Size(_tlpWidth, 0),
4141
Location = new Point(Defaults.PanelLeft, Defaults.PanelTop)
4242
};
43-
43+
_tlp.SetDoubleBuffered(true);
4444
_tlp.RowStyles.Clear();
4545
_tlp.ColumnStyles.Clear();
4646

File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)