forked from JohannBlais/InformationBox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathInformationBoxDesigner.cs
766 lines (648 loc) · 27.4 KB
/
InformationBoxDesigner.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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
// <copyright file="InformationBoxDesigner.cs" company="Johann Blais">
// Copyright (c) 2008 All Right Reserved
// </copyright>
// <author>Johann Blais</author>
// <summary>Designer window</summary>
namespace InfoBox.Designer
{
using InfoBox.Designer.CodeGeneration;
using System;
using System.Drawing;
using System.Globalization;
using System.Threading;
using System.Windows.Forms;
/// <summary>
/// Designer for the InformationBoxes.
/// </summary>
public partial class InformationBoxDesigner : Form
{
#region Attributes
/// <summary>
/// Color of the bars
/// </summary>
private Color barsColor = Color.Empty;
/// <summary>
/// Color of the form
/// </summary>
private Color formColor = Color.Empty;
#endregion Attributes
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="InformationBoxDesigner"/> class.
/// </summary>
public InformationBoxDesigner()
{
this.InitializeComponent();
this.LoadIcons();
this.LoadButtons();
this.LoadResults();
this.LoadOpacities();
this.LoadBindings();
}
#endregion Constructors
#region Display
/// <summary>
/// Call when a asynchronous InformationBox is closed.
/// </summary>
/// <param name="result">The result.</param>
private static void BoxClosed(InformationBoxResult result)
{
InformationBox.Show(String.Format(CultureInfo.InvariantCulture, "I am the result of a modeless box : " + result));
}
/// <summary>
/// Shows the box.
/// </summary>
/// <param name="behavior">The behavior.</param>
private void ShowBox(InformationBoxBehavior behavior)
{
InformationBoxButtons buttons = this.GetButtons();
InformationBoxIcon icon = this.GetIcon();
string iconFileName = this.txbIcon.Text;
InformationBoxDefaultButton defaultButton = this.GetDefaultButton();
InformationBoxButtonsLayout buttonsLayout = this.GetButtonsLayout();
InformationBoxAutoSizeMode autoSize = this.GetAutoSize();
InformationBoxPosition position = this.GetPosition();
HelpNavigator navigator = this.GetHelpNavigator();
InformationBoxCheckBox checkState = this.GetCheckBoxState();
CheckState state = 0;
string doNotShowAgainText = String.IsNullOrEmpty(this.txtDoNotShowText.Text) ? null : this.txtDoNotShowText.Text;
InformationBoxStyle style = this.GetStyle();
AutoCloseParameters autoClose = this.GetAutoClose();
DesignParameters design = this.GetDesign();
InformationBoxTitleIconStyle titleStyle = this.GetTitleStyle();
InformationBoxOpacity opacity = this.GetOpacity();
InformationBoxOrder order = this.GetOrder();
InformationBoxSound sound = this.GetSound();
InformationBoxTitleIcon titleIcon = null;
if (titleStyle == InformationBoxTitleIconStyle.Custom)
{
titleIcon = new InformationBoxTitleIcon(this.txbTitleIconFile.Text);
}
if (String.IsNullOrEmpty(iconFileName))
{
InformationBox.Show(this.txbText.Text, out state, this.txbTitle.Text, buttons, new string[] { this.txbUser1.Text, this.txbUser2.Text, this.txbUser3.Text }, icon, defaultButton, buttonsLayout, autoSize, position, this.chbHelpButton.Checked, this.txbHelpFile.Text, navigator, this.txbHelpTopic.Text, checkState, doNotShowAgainText, style, autoClose, design, titleStyle, titleIcon, behavior, new AsyncResultCallback(BoxClosed), opacity, order, sound);
}
else
{
InformationBox.Show(this.txbText.Text, out state, this.txbTitle.Text, buttons, new string[] { this.txbUser1.Text, this.txbUser2.Text, this.txbUser3.Text }, new Icon(iconFileName), defaultButton, buttonsLayout, autoSize, position, this.chbHelpButton.Checked, this.txbHelpFile.Text, navigator, this.txbHelpTopic.Text, checkState, doNotShowAgainText, style, autoClose, design, titleStyle, titleIcon, behavior, new AsyncResultCallback(BoxClosed), opacity, order, sound);
}
if (checkState != 0)
{
InformationBox.Show(
String.Format(CultureInfo.InvariantCulture, "The state of the checkbox was {0}", state),
InformationBoxIcon.Information);
}
}
#endregion Display
#region Loading
/// <summary>
/// Loads the icons.
/// </summary>
private void LoadIcons()
{
foreach (InformationBoxIcon icon in Enum.GetValues(typeof(InformationBoxIcon)))
{
this.ddlIcons.Items.Add(icon);
}
}
/// <summary>
/// Loads the opacities.
/// </summary>
private void LoadOpacities()
{
foreach (InformationBoxOpacity op in Enum.GetValues(typeof(InformationBoxOpacity)))
{
this.ddlOpacities.Items.Add(op);
}
this.ddlOpacities.SelectedItem = InformationBoxOpacity.NoFade;
}
/// <summary>
/// Loads the buttons.
/// </summary>
private void LoadButtons()
{
foreach (InformationBoxDefaultButton icon in Enum.GetValues(typeof(InformationBoxDefaultButton)))
{
this.ddlAutoCloseButton.Items.Add(icon);
}
}
/// <summary>
/// Loads the results.
/// </summary>
private void LoadResults()
{
foreach (InformationBoxResult icon in Enum.GetValues(typeof(InformationBoxResult)))
{
this.ddlAutoCloseResult.Items.Add(icon);
}
}
/// <summary>
/// Loads the bindings.
/// </summary>
private void LoadBindings()
{
this.rdbAutoCloseButton.DataBindings.Add("Enabled", this.chbActivateAutoClose, "Checked");
this.rdbAutoCloseResult.DataBindings.Add("Enabled", this.chbActivateAutoClose, "Checked");
this.nudAutoCloseSeconds.DataBindings.Add("Enabled", this.chbActivateAutoClose, "Checked");
this.lblAutoCloseSeconds.DataBindings.Add("Enabled", this.chbActivateAutoClose, "Checked");
this.lblAutoCloseButton.DataBindings.Add("Enabled", this.rdbAutoCloseButton, "Checked");
this.ddlAutoCloseButton.DataBindings.Add("Enabled", this.rdbAutoCloseButton, "Checked");
this.lblAutoCloseResult.DataBindings.Add("Enabled", this.rdbAutoCloseResult, "Checked");
this.ddlAutoCloseResult.DataBindings.Add("Enabled", this.rdbAutoCloseResult, "Checked");
this.lblColorsBars.DataBindings.Add("Enabled", this.chbCustomColors, "Checked");
this.lblColorsForm.DataBindings.Add("Enabled", this.chbCustomColors, "Checked");
this.txbColorsBars.DataBindings.Add("Enabled", this.chbCustomColors, "Checked");
this.txbColorsForm.DataBindings.Add("Enabled", this.chbCustomColors, "Checked");
this.btnColorsBars.DataBindings.Add("Enabled", this.chbCustomColors, "Checked");
this.btnColorsForm.DataBindings.Add("Enabled", this.chbCustomColors, "Checked");
this.lblTitleIcon.DataBindings.Add("Enabled", this.rdbTitleIconCustom, "Checked");
this.txbTitleIconFile.DataBindings.Add("Enabled", this.rdbTitleIconCustom, "Checked");
this.btnTitleIconFile.DataBindings.Add("Enabled", this.rdbTitleIconCustom, "Checked");
}
#endregion Loading
#region Values
/// <summary>
/// Gets the buttons.
/// </summary>
/// <returns>The value of the buttons</returns>
private InformationBoxButtons GetButtons()
{
if (this.rdbAbortRetryIgnore.Checked)
{
return InformationBoxButtons.AbortRetryIgnore;
}
if (this.rdbOK.Checked)
{
return InformationBoxButtons.OK;
}
if (this.rdbOKCancel.Checked)
{
return InformationBoxButtons.OKCancel;
}
if (this.rdbRetryCancel.Checked)
{
return InformationBoxButtons.RetryCancel;
}
if (this.rdbYesNo.Checked)
{
return InformationBoxButtons.YesNo;
}
if (this.rdbYesNoCancel.Checked)
{
return InformationBoxButtons.YesNoCancel;
}
if (this.rdbYesNoUser1.Checked)
{
return InformationBoxButtons.YesNoUser1;
}
if (this.rdbOKCancelUser1.Checked)
{
return InformationBoxButtons.OKCancelUser1;
}
if (this.rdbUser1User2User3.Checked)
{
return InformationBoxButtons.User1User2User3;
}
if (this.rdbUser1User2.Checked)
{
return InformationBoxButtons.User1User2;
}
if (this.rdbUser1.Checked)
{
return InformationBoxButtons.User1;
}
return InformationBoxButtons.OK;
}
/// <summary>
/// Gets the icon.
/// </summary>
/// <returns>The selected icon</returns>
private InformationBoxIcon GetIcon()
{
if (null != this.ddlIcons.SelectedItem)
{
return (InformationBoxIcon)this.ddlIcons.SelectedItem;
}
return InformationBoxIcon.None;
}
/// <summary>
/// Gets the opacity.
/// </summary>
/// <returns>The opacity</returns>
private InformationBoxOpacity GetOpacity()
{
if (null != this.ddlOpacities.SelectedItem)
{
return (InformationBoxOpacity)this.ddlOpacities.SelectedItem;
}
return InformationBoxOpacity.NoFade;
}
/// <summary>
/// Gets the default button.
/// </summary>
/// <returns>The default button</returns>
private InformationBoxDefaultButton GetDefaultButton()
{
if (this.rdbDefaultButton1.Checked)
{
return InformationBoxDefaultButton.Button1;
}
if (this.rdbDefaultButton2.Checked)
{
return InformationBoxDefaultButton.Button2;
}
if (this.rdbDefaultButton3.Checked)
{
return InformationBoxDefaultButton.Button3;
}
return InformationBoxDefaultButton.Button1;
}
/// <summary>
/// Gets the buttons layout.
/// </summary>
/// <returns>The buttons layout</returns>
private InformationBoxButtonsLayout GetButtonsLayout()
{
if (this.rdbLayoutGroupLeft.Checked)
{
return InformationBoxButtonsLayout.GroupLeft;
}
if (this.rdbLayoutGroupRight.Checked)
{
return InformationBoxButtonsLayout.GroupRight;
}
if (this.rdbLayoutGroupMiddle.Checked)
{
return InformationBoxButtonsLayout.GroupMiddle;
}
if (this.rdbLayoutSeparate.Checked)
{
return InformationBoxButtonsLayout.Separate;
}
return InformationBoxButtonsLayout.GroupMiddle;
}
/// <summary>
/// Gets the auto size mode.
/// </summary>
/// <returns>The auto size mode</returns>
private InformationBoxAutoSizeMode GetAutoSize()
{
if (this.rdbAutoSizeMinimumHeight.Checked)
{
return InformationBoxAutoSizeMode.MinimumHeight;
}
if (this.rdbAutoSizeMinimumWidth.Checked)
{
return InformationBoxAutoSizeMode.MinimumWidth;
}
return InformationBoxAutoSizeMode.None;
}
/// <summary>
/// Gets the position.
/// </summary>
/// <returns>The position</returns>
private InformationBoxPosition GetPosition()
{
if (this.rdbPositionCenterOnParent.Checked)
{
return InformationBoxPosition.CenterOnParent;
}
if (this.rdbPositionCenterOnScreen.Checked)
{
return InformationBoxPosition.CenterOnScreen;
}
return InformationBoxPosition.CenterOnParent;
}
/// <summary>
/// Gets the help navigator.
/// </summary>
/// <returns>The help navigator</returns>
private HelpNavigator GetHelpNavigator()
{
if (this.rdbHelpFind.Checked)
{
return HelpNavigator.Find;
}
if (this.rdbHelpIndex.Checked)
{
return HelpNavigator.Index;
}
if (this.rdbHelpTopic.Checked)
{
return HelpNavigator.Topic;
}
if (this.rdbHelpTableOfContents.Checked)
{
return HelpNavigator.TableOfContents;
}
return 0;
}
/// <summary>
/// Gets the z-order of the form.
/// </summary>
/// <returns>The z-order of the form</returns>
private InformationBoxOrder GetOrder()
{
InformationBoxOrder order = InformationBoxOrder.Default;
if (rdbOrderTopMost.Checked)
{
order = InformationBoxOrder.TopMost;
}
return order;
}
/// <summary>
/// Gets the sound of the form.
/// </summary>
/// <returns>The sound of the form</returns>
private InformationBoxSound GetSound()
{
InformationBoxSound sound = InformationBoxSound.Default;
if (rdbSoundMute.Checked)
{
sound = InformationBoxSound.None;
}
return sound;
}
/// <summary>
/// Gets the state of the check box.
/// </summary>
/// <returns>The state of the checkbox</returns>
private InformationBoxCheckBox GetCheckBoxState()
{
InformationBoxCheckBox check = 0;
if (this.clbCheckBox.GetItemCheckState(0) == CheckState.Checked)
{
check |= InformationBoxCheckBox.Show;
}
if (this.clbCheckBox.GetItemCheckState(1) == CheckState.Checked)
{
check |= InformationBoxCheckBox.Checked;
}
if (this.clbCheckBox.GetItemCheckState(2) == CheckState.Checked)
{
check |= InformationBoxCheckBox.RightAligned;
}
return check;
}
/// <summary>
/// Gets the auto close.
/// </summary>
/// <returns>The auto close parameters</returns>
private AutoCloseParameters GetAutoClose()
{
if (!this.chbActivateAutoClose.Checked)
{
return null;
}
if (this.nudAutoCloseSeconds.Value == 30 &&
(!this.rdbAutoCloseButton.Checked || this.ddlAutoCloseButton.SelectedIndex == -1) &&
(!this.rdbAutoCloseResult.Checked || this.ddlAutoCloseResult.SelectedIndex == -1))
{
return AutoCloseParameters.Default;
}
if (this.rdbAutoCloseButton.Checked && this.ddlAutoCloseButton.SelectedIndex != -1)
{
return new AutoCloseParameters(
Convert.ToInt32(this.nudAutoCloseSeconds.Value),
(InformationBoxDefaultButton)Enum.Parse(typeof(InformationBoxDefaultButton), this.ddlAutoCloseButton.SelectedItem.ToString()));
}
if (this.rdbAutoCloseResult.Checked && this.ddlAutoCloseResult.SelectedIndex != -1)
{
return new AutoCloseParameters(
Convert.ToInt32(this.nudAutoCloseSeconds.Value),
(InformationBoxResult)Enum.Parse(typeof(InformationBoxResult), this.ddlAutoCloseResult.SelectedItem.ToString()));
}
return new AutoCloseParameters(Convert.ToInt32(this.nudAutoCloseSeconds.Value));
}
/// <summary>
/// Gets the style.
/// </summary>
/// <returns>The style.</returns>
private InformationBoxStyle GetStyle()
{
if (this.rdbStyleModern.Checked)
{
return InformationBoxStyle.Modern;
}
return InformationBoxStyle.Standard;
}
/// <summary>
/// Gets the design.
/// </summary>
/// <returns>The design.</returns>
private DesignParameters GetDesign()
{
if (!this.chbCustomColors.Checked)
{
return null;
}
return new DesignParameters(this.formColor, this.barsColor);
}
/// <summary>
/// Gets the title style.
/// </summary>
/// <returns>The style of the title</returns>
private InformationBoxTitleIconStyle GetTitleStyle()
{
if (this.rdbTitleIconNone.Checked)
{
return InformationBoxTitleIconStyle.None;
}
if (this.rdbTitleIconCustom.Checked)
{
return InformationBoxTitleIconStyle.Custom;
}
if (this.rdbTitleIconSameAsBox.Checked)
{
return InformationBoxTitleIconStyle.SameAsBox;
}
return InformationBoxTitleIconStyle.SameAsBox;
}
#endregion Values
#region Code generation
/// <summary>
/// Generates the code.
/// </summary>
/// <param name="behavior">The behavior.</param>
private void GenerateCode(InformationBoxBehavior behavior, Language language)
{
var buttons = this.GetButtons();
var icon = this.GetIcon();
var iconFileName = this.txbIcon.Text;
var defaultButton = this.GetDefaultButton();
var buttonsLayout = this.GetButtonsLayout();
var autoSize = this.GetAutoSize();
var position = this.GetPosition();
var navigator = this.GetHelpNavigator();
var checkState = this.GetCheckBoxState();
var doNotShowAgainText = String.IsNullOrEmpty(this.txtDoNotShowText.Text) ? null : this.txtDoNotShowText.Text;
var style = this.GetStyle();
var autoClose = this.GetAutoClose();
var design = this.GetDesign();
var titleStyle = this.GetTitleStyle();
var opacity = this.GetOpacity();
var order = this.GetOrder();
var sound = this.GetSound();
var factory = new CodeGeneratorFactory();
var codeGen = factory.CreateGenerator(language);
var generatedCode = codeGen.GenerateSingleCall(
behavior, this.txbText.Text, this.txbTitle.Text, buttons, this.txbUser1.Text, this.txbUser2.Text, this.txbUser3.Text,
icon, iconFileName, defaultButton, buttonsLayout, autoSize, position, this.chbHelpButton.Checked,
this.txbHelpFile.Text, this.txbHelpTopic.Text, navigator, checkState, doNotShowAgainText, style, this.chbActivateAutoClose.Checked,
autoClose, design, titleStyle, this.txbTitleIconFile.Text, opacity, order, sound);
this.txbCode.Text = generatedCode;
}
#endregion Code generation
#region Event handlers
/// <summary>
/// Handles the Click event of the btnShowModeless control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void BtnShowModeless_Click(object sender, EventArgs e)
{
if (null != this.ddlLanguage.SelectedItem)
{
string culture = this.ddlLanguage.SelectedItem.ToString();
if (culture[2] == '-')
{
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(this.ddlLanguage.SelectedItem.ToString().Substring(0, 5));
}
else
{
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(this.ddlLanguage.SelectedItem.ToString().Substring(0, 2));
}
}
this.ShowBox(InformationBoxBehavior.Modeless);
}
/// <summary>
/// Handles the Click event of the btnShow control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void BtnShow_Click(object sender, EventArgs e)
{
if (null != this.ddlLanguage.SelectedItem)
{
string culture = this.ddlLanguage.SelectedItem.ToString();
if (culture[2] == '-')
{
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(this.ddlLanguage.SelectedItem.ToString().Substring(0, 5));
}
else
{
Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(this.ddlLanguage.SelectedItem.ToString().Substring(0, 2));
}
}
this.ShowBox(InformationBoxBehavior.Modal);
}
/// <summary>
/// Handles the Click event of the btnGenerate control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void BtnGenerate_Click(object sender, EventArgs e)
{
cmsLanguage.Show(btnGenerate, new Point(0, btnGenerate.Height));
}
/// <summary>
/// Handles the Click event of the tsmCSharp control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void tsmCSharp_Click(object sender, EventArgs e)
{
this.GenerateCode(InformationBoxBehavior.Modal, Language.CSharp);
}
/// <summary>
/// Handles the Click event of the tsmVbNet control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void tsmVbNet_Click(object sender, EventArgs e)
{
this.GenerateCode(InformationBoxBehavior.Modal, Language.VBNET);
}
/// <summary>
/// Handles the Click event of the btnIcon control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void BtnIcon_Click(object sender, EventArgs e)
{
if (this.ofdIcon.ShowDialog() != DialogResult.OK)
{
this.txbIcon.Text = String.Empty;
}
this.txbIcon.Text = this.ofdIcon.FileName;
}
/// <summary>
/// Handles the Click event of the btnTitleIconFile control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void BtnTitleIconFile_Click(object sender, EventArgs e)
{
if (this.ofdIcon.ShowDialog() != DialogResult.OK)
{
this.txbTitleIconFile.Text = String.Empty;
}
this.txbTitleIconFile.Text = this.ofdIcon.FileName;
}
/// <summary>
/// Handles the Click event of the btnHelpFile control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void BtnHelpFile_Click(object sender, EventArgs e)
{
if (this.ofdHelpFile.ShowDialog() != DialogResult.OK)
{
this.txbHelpFile.Text = String.Empty;
}
this.txbHelpFile.Text = this.ofdHelpFile.FileName;
}
/// <summary>
/// Handles the HelpRequested event of the Form1 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="hlpevent">The <see cref="System.Windows.Forms.HelpEventArgs"/> instance containing the event data.</param>
private void Form1_HelpRequested(object sender, HelpEventArgs hlpevent)
{
InformationBox.Show("Help has been requested somewhere", "Help", InformationBoxButtons.OK, InformationBoxIcon.Question);
}
#region Colors
/// <summary>
/// Handles the Click event of the btnColorsBars control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void BtnColorsBars_Click(object sender, EventArgs e)
{
if (this.dlgColor.ShowDialog() != DialogResult.OK)
{
return;
}
Color selected = this.dlgColor.Color;
this.txbColorsBars.Text = selected.ToString();
this.barsColor = selected;
}
/// <summary>
/// Handles the Click event of the btnColorsForm control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
private void BtnColorsForm_Click(object sender, EventArgs e)
{
if (this.dlgColor.ShowDialog() != DialogResult.OK)
{
return;
}
Color selected = this.dlgColor.Color;
this.txbColorsForm.Text = selected.ToString();
this.formColor = selected;
}
#endregion Colors
#endregion Event handlers
}
}