-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProgressbarForm.cs
96 lines (88 loc) · 2.8 KB
/
ProgressbarForm.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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace Tritronix.BakingOven
{
public partial class ProgressbarForm : Form
{
/// <summary>
/// Dient zum erstellen eines ProgressbarForms
/// </summary>
/// <param name="name">Angezeigter Name des Fensters</param>
/// <param name="text">Name des Labels, z.B.: "Bitte Warten..."</param>
/// <param name="progMaxValue">Maximaler Wert des Progressbars</param>
/// <param name="progStepValue">Schrittgröße des Progressbars</param>
public ProgressbarForm(string name, string text, int progMaxValue, int progStepValue)
{
InitializeComponent();
this.Text = name;
this.lblMain.Text = text;
this.pgbMain.Maximum = progMaxValue;
this.pgbMain.Step = progStepValue;
}
///////////////////////////////
//METHODES
/// <summary>
/// Erhöht den Wert der Progressbar um die Schrittweite
/// ist der max. Wert erreicht wird das ProgressbarForm geschlossen
/// </summary>
public void ProgressbarPerformStep()
{
try
{
this.pgbMain.PerformStep();
if (this.pgbMain.Value == this.pgbMain.Maximum) this.Dispose();
}
catch(InvalidOperationException)
{
//MaximumValue wurde überschritten...
this.Dispose();
}
}
/// <summary>
/// Setzt bzw gibt den Wert des Progrogressbars zurück
/// </summary>
public int ProgressbarValueSetGet
{
set
{
try { this.pgbMain.Value = value; }
catch (Exception ex) { throw ex; }
}
get { return this.pgbMain.Value; }
}
/// <summary>
/// Verändert die Stepgröße
/// </summary>
public int ProgressBarStepSizeSetGet
{
set { this.pgbMain.Step = value; }
get { return this.pgbMain.Step; }
}
/// <summary>
/// Setzt bzw gibt den Text des Labels zurück
/// </summary>
public string LabelText
{
set { this.lblMain.Text = value; }
get { return this.lblMain.Text; }
}
/// <summary>
/// Setzt bzw. gibt den Text der Form zurück
/// </summary>
public string FormText
{
set { this.Text = value; }
get { return this.Text; }
}
private void ProgressbarForm_Load(object sender, EventArgs e)
{
if (this.Height != 115) this.Height = 115;
}
}
}