Datei: NDOPackage/PersistentClassDialog.cs
Last Commit (e424d5f)
1 | // |
2 | // Copyright (c) 2002-2022 Mirko Matytschak |
3 | // (www.netdataobjects.de) |
4 | // |
5 | // Author: Mirko Matytschak |
6 | // |
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated |
8 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation |
9 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the |
10 | // Software, and to permit persons to whom the Software is furnished to do so, subject to the following |
11 | // conditions: |
12 | |
13 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions |
14 | // of the Software. |
15 | // |
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED |
17 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF |
19 | // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. |
21 | |
22 | |
23 | using System; |
24 | using System.Drawing; |
25 | using System.Collections; |
26 | using System.ComponentModel; |
27 | using System.Windows.Forms; |
28 | |
29 | namespace NDOVsPackage |
30 | { |
31 | ····/// <summary> |
32 | ····/// Zusammenfassung für PersistentClassDialog. |
33 | ····/// </summary> |
34 | ····internal class PersistentClassDialog : System.Windows.Forms.Form |
35 | ····{ |
36 | ········private System.Windows.Forms.Label label1; |
37 | ········ |
38 | ········private DialogResult result; |
39 | ········public DialogResult Result { get { return this.result; } } |
40 | ········public string ClassName { get { return this.txtClassName.Text; } } |
41 | ········public bool Serializable { get { return this.chkSerializable.Checked; } } |
42 | |
43 | ········private System.Windows.Forms.TextBox txtClassName; |
44 | ········private System.Windows.Forms.Button btnCancel; |
45 | ········private System.Windows.Forms.Button btnOK; |
46 | ········private System.Windows.Forms.CheckBox chkSerializable; |
47 | |
48 | ········/// <summary> |
49 | ········/// Erforderliche Designervariable. |
50 | ········/// </summary> |
51 | ········private System.ComponentModel.Container components = null; |
52 | |
53 | ········public PersistentClassDialog() |
54 | ········{ |
55 | ············// |
56 | ············// Erforderlich für die Windows Form-Designerunterstützung |
57 | ············// |
58 | ············InitializeComponent(); |
59 | |
60 | if ( Screen. FromControl( this ) . Bounds. Width >= 2600) |
61 | Font = new Font( "Segoe UI", 11f, FontStyle. Regular, GraphicsUnit. Point, 0 ) ; |
62 | ········} |
63 | |
64 | ········/// <summary> |
65 | ········/// Die verwendeten Ressourcen bereinigen. |
66 | ········/// </summary> |
67 | ········protected override void Dispose( bool disposing ) |
68 | ········{ |
69 | ············if( disposing ) |
70 | ············{ |
71 | ················if(components != null) |
72 | ················{ |
73 | ····················components.Dispose(); |
74 | ················} |
75 | ············} |
76 | ············base.Dispose( disposing ); |
77 | ········} |
78 | |
79 | ········#region Vom Windows Form-Designer generierter Code |
80 | ········/// <summary> |
81 | ········/// Erforderliche Methode für die Designerunterstützung. |
82 | ········/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. |
83 | ········/// </summary> |
84 | ········private void InitializeComponent() |
85 | ········{ |
86 | System. Resources. ResourceManager resources = new System. Resources. ResourceManager( typeof( PersistentClassDialog) ) ; |
87 | ············this.txtClassName = new System.Windows.Forms.TextBox(); |
88 | ············this.label1 = new System.Windows.Forms.Label(); |
89 | ············this.btnCancel = new System.Windows.Forms.Button(); |
90 | ············this.btnOK = new System.Windows.Forms.Button(); |
91 | ············this.chkSerializable = new System.Windows.Forms.CheckBox(); |
92 | ············this.SuspendLayout(); |
93 | ············// |
94 | ············// txtClassName |
95 | ············// |
96 | this. txtClassName. Location = new System. Drawing. Point( 16, 64) ; |
97 | ············this.txtClassName.Name = "txtClassName"; |
98 | this. txtClassName. Size = new System. Drawing. Size( 400, 22) ; |
99 | ············this.txtClassName.TabIndex = 0; |
100 | ············this.txtClassName.Text = ""; |
101 | ············// |
102 | ············// label1 |
103 | ············// |
104 | this. label1. Location = new System. Drawing. Point( 16, 24) ; |
105 | ············this.label1.Name = "label1"; |
106 | this. label1. Size = new System. Drawing. Size( 168, 24) ; |
107 | ············this.label1.TabIndex = 1; |
108 | ············this.label1.Text = "Class Name"; |
109 | ············// |
110 | ············// btnCancel |
111 | ············// |
112 | ············this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
113 | this. btnCancel. Location = new System. Drawing. Point( 104, 152) ; |
114 | ············this.btnCancel.Name = "btnCancel"; |
115 | this. btnCancel. Size = new System. Drawing. Size( 144, 32) ; |
116 | ············this.btnCancel.TabIndex = 2; |
117 | ············this.btnCancel.Text = "Cancel"; |
118 | ············this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); |
119 | ············// |
120 | ············// btnOK |
121 | ············// |
122 | ············this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; |
123 | this. btnOK. Location = new System. Drawing. Point( 264, 152) ; |
124 | ············this.btnOK.Name = "btnOK"; |
125 | this. btnOK. Size = new System. Drawing. Size( 144, 32) ; |
126 | ············this.btnOK.TabIndex = 3; |
127 | ············this.btnOK.Text = "OK"; |
128 | ············this.btnOK.Click += new System.EventHandler(this.btnOK_Click); |
129 | ············// |
130 | ············// chkSerializable |
131 | ············// |
132 | this. chkSerializable. Location = new System. Drawing. Point( 16, 104) ; |
133 | ············this.chkSerializable.Name = "chkSerializable"; |
134 | this. chkSerializable. Size = new System. Drawing. Size( 240, 24) ; |
135 | ············this.chkSerializable.TabIndex = 4; |
136 | ············this.chkSerializable.Text = "Serializable"; |
137 | ············// |
138 | ············// PersistentClassDialog |
139 | ············// |
140 | ············this.AcceptButton = this.btnOK; |
141 | this. AutoScaleBaseSize = new System. Drawing. Size( 6, 15) ; |
142 | ············this.AutoScaleMode = AutoScaleMode.Font; |
143 | ············this.CancelButton = this.btnCancel; |
144 | this. ClientSize = new System. Drawing. Size( 440, 208) ; |
145 | ············this.Controls.Add(this.chkSerializable); |
146 | ············this.Controls.Add(this.btnOK); |
147 | ············this.Controls.Add(this.btnCancel); |
148 | ············this.Controls.Add(this.label1); |
149 | ············this.Controls.Add(this.txtClassName); |
150 | ············this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); |
151 | ············this.Name = "PersistentClassDialog"; |
152 | ············this.Text = "Add Persistent Class"; |
153 | ············this.ResumeLayout(false); |
154 | |
155 | ········} |
156 | ········#endregion |
157 | |
158 | ········private void btnOK_Click(object sender, System.EventArgs e) |
159 | ········{ |
160 | ············if (this.txtClassName.Text.Trim() == string.Empty) |
161 | ················result = DialogResult.Cancel; |
162 | ············else |
163 | ················result = DialogResult.OK; |
164 | ············this.Close(); |
165 | ········} |
166 | |
167 | ········private void btnCancel_Click(object sender, System.EventArgs e) |
168 | ········{ |
169 | ············result = DialogResult.Cancel; |
170 | ············this.Close(); |
171 | ········} |
172 | |
173 | ····} |
174 | } |
175 |
New Commit (5192672)
1 | // |
2 | // Copyright (c) 2002-2022 Mirko Matytschak |
3 | // (www.netdataobjects.de) |
4 | // |
5 | // Author: Mirko Matytschak |
6 | // |
7 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated |
8 | // documentation files (the "Software"), to deal in the Software without restriction, including without limitation |
9 | // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the |
10 | // Software, and to permit persons to whom the Software is furnished to do so, subject to the following |
11 | // conditions: |
12 | |
13 | // The above copyright notice and this permission notice shall be included in all copies or substantial portions |
14 | // of the Software. |
15 | // |
16 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED |
17 | // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
18 | // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF |
19 | // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. |
21 | |
22 | |
23 | using System; |
24 | using System.Drawing; |
25 | using System.Collections; |
26 | using System.ComponentModel; |
27 | using System.Windows.Forms; |
28 | using WinForms.FontSize; |
29 | |
30 | namespace NDOVsPackage |
31 | { |
32 | ····/// <summary> |
33 | ····/// Zusammenfassung für PersistentClassDialog. |
34 | ····/// </summary> |
35 | ····internal class PersistentClassDialog : System.Windows.Forms.Form |
36 | ····{ |
37 | ········private System.Windows.Forms.Label label1; |
38 | ········ |
39 | ········private DialogResult result; |
40 | ········public DialogResult Result { get { return this.result; } } |
41 | ········public string ClassName { get { return this.txtClassName.Text; } } |
42 | ········public bool Serializable { get { return this.chkSerializable.Checked; } } |
43 | |
44 | ········private System.Windows.Forms.TextBox txtClassName; |
45 | ········private System.Windows.Forms.Button btnCancel; |
46 | ········private System.Windows.Forms.Button btnOK; |
47 | ········private System.Windows.Forms.CheckBox chkSerializable; |
48 | |
49 | ········/// <summary> |
50 | ········/// Erforderliche Designervariable. |
51 | ········/// </summary> |
52 | ········private System.ComponentModel.Container components = null; |
53 | |
54 | ········public PersistentClassDialog() |
55 | ········{ |
56 | ············// |
57 | ············// Erforderlich für die Windows Form-Designerunterstützung |
58 | ············// |
59 | ············InitializeComponent(); |
60 | |
61 | // Calculate the new font size after InitializeComponent |
62 | var newFontSize = FontCalculator. Calculate( Screen. FromControl( this) , Font. Size) ; |
63 | ············if (newFontSize > Font.Size) |
64 | ················Font = new Font( Font.FontFamily, newFontSize, FontStyle.Regular, GraphicsUnit.Point, 0 ); |
65 | ········} |
66 | |
67 | ········/// <summary> |
68 | ········/// Die verwendeten Ressourcen bereinigen. |
69 | ········/// </summary> |
70 | ········protected override void Dispose( bool disposing ) |
71 | ········{ |
72 | ············if( disposing ) |
73 | ············{ |
74 | ················if(components != null) |
75 | ················{ |
76 | ····················components.Dispose(); |
77 | ················} |
78 | ············} |
79 | ············base.Dispose( disposing ); |
80 | ········} |
81 | |
82 | ········#region Vom Windows Form-Designer generierter Code |
83 | ········/// <summary> |
84 | ········/// Erforderliche Methode für die Designerunterstützung. |
85 | ········/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. |
86 | ········/// </summary> |
87 | ········private void InitializeComponent() |
88 | ········{ |
89 | System. ComponentModel. ComponentResourceManager resources = new System. ComponentModel. ComponentResourceManager( typeof( PersistentClassDialog) ) ; |
90 | ············this.txtClassName = new System.Windows.Forms.TextBox(); |
91 | ············this.label1 = new System.Windows.Forms.Label(); |
92 | ············this.btnCancel = new System.Windows.Forms.Button(); |
93 | ············this.btnOK = new System.Windows.Forms.Button(); |
94 | ············this.chkSerializable = new System.Windows.Forms.CheckBox(); |
95 | ············this.SuspendLayout(); |
96 | ············// |
97 | ············// txtClassName |
98 | ············// |
99 | this. txtClassName. Location = new System. Drawing. Point( 13, 55) ; |
100 | ············this.txtClassName.Name = "txtClassName"; |
101 | this. txtClassName. Size = new System. Drawing. Size( 334, 20) ; |
102 | ············this.txtClassName.TabIndex = 0; |
103 | ············// |
104 | ············// label1 |
105 | ············// |
106 | this. label1. Location = new System. Drawing. Point( 13, 21) ; |
107 | ············this.label1.Name = "label1"; |
108 | this. label1. Size = new System. Drawing. Size( 140, 21) ; |
109 | ············this.label1.TabIndex = 1; |
110 | ············this.label1.Text = "Class Name"; |
111 | ············// |
112 | ············// btnCancel |
113 | ············// |
114 | ············this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
115 | this. btnCancel. Location = new System. Drawing. Point( 87, 132) ; |
116 | ············this.btnCancel.Name = "btnCancel"; |
117 | this. btnCancel. Size = new System. Drawing. Size( 120, 27) ; |
118 | ············this.btnCancel.TabIndex = 2; |
119 | ············this.btnCancel.Text = "Cancel"; |
120 | ············this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click); |
121 | ············// |
122 | ············// btnOK |
123 | ············// |
124 | ············this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK; |
125 | this. btnOK. Location = new System. Drawing. Point( 220, 132) ; |
126 | ············this.btnOK.Name = "btnOK"; |
127 | this. btnOK. Size = new System. Drawing. Size( 120, 27) ; |
128 | ············this.btnOK.TabIndex = 3; |
129 | ············this.btnOK.Text = "OK"; |
130 | ············this.btnOK.Click += new System.EventHandler(this.btnOK_Click); |
131 | ············// |
132 | ············// chkSerializable |
133 | ············// |
134 | this. chkSerializable. Location = new System. Drawing. Point( 13, 90) ; |
135 | ············this.chkSerializable.Name = "chkSerializable"; |
136 | this. chkSerializable. Size = new System. Drawing. Size( 200, 21) ; |
137 | ············this.chkSerializable.TabIndex = 4; |
138 | ············this.chkSerializable.Text = "Serializable"; |
139 | ············// |
140 | ············// PersistentClassDialog |
141 | ············// |
142 | ············this.AcceptButton = this.btnOK; |
143 | this. AutoScaleDimensions = new System. Drawing. SizeF( 6F, 13F) ; |
144 | ············this.AutoScaleMode = AutoScaleMode.Font; |
145 | ············this.CancelButton = this.btnCancel; |
146 | this. ClientSize = new System. Drawing. Size( 378, 183) ; |
147 | ············this.Controls.Add(this.chkSerializable); |
148 | ············this.Controls.Add(this.btnOK); |
149 | ············this.Controls.Add(this.btnCancel); |
150 | ············this.Controls.Add(this.label1); |
151 | ············this.Controls.Add(this.txtClassName); |
152 | ············this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); |
153 | ············this.Name = "PersistentClassDialog"; |
154 | ············this.Text = "Add Persistent Class"; |
155 | ············this.ResumeLayout(false); |
156 | ············this.PerformLayout(); |
157 | |
158 | ········} |
159 | ········#endregion |
160 | |
161 | ········private void btnOK_Click(object sender, System.EventArgs e) |
162 | ········{ |
163 | ············if (this.txtClassName.Text.Trim() == string.Empty) |
164 | ················result = DialogResult.Cancel; |
165 | ············else |
166 | ················result = DialogResult.OK; |
167 | ············this.Close(); |
168 | ········} |
169 | |
170 | ········private void btnCancel_Click(object sender, System.EventArgs e) |
171 | ········{ |
172 | ············result = DialogResult.Cancel; |
173 | ············this.Close(); |
174 | ········} |
175 | |
176 | ····} |
177 | } |
178 |