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
|
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Copyright (c) 2006 Novell, Inc.
//
// Authors:
// Jonathan Chambers (jonathan.chambers@ansys.com)
//
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.ComponentModel.Design.Serialization;
using System.Collections;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Printing;
using System.Reflection;
namespace System.Windows.Forms {
public sealed class PageSetupDialog : CommonDialog {
#region Local variables
private PrintDocument document;
private PageSettings page_settings;
private PrinterSettings printer_settings;
private Margins min_margins;
private bool allow_margins;
private bool allow_orientation;
private bool allow_paper;
private bool allow_printer;
private bool show_help;
private bool show_network;
private GroupBox groupbox_paper;
private Label label_source;
private Label label_size;
private GroupBox groupbox_orientation;
private RadioButton radio_landscape;
private RadioButton radio_portrait;
private GroupBox groupbox_margin;
private Label label_left;
private Button button_ok;
private Button button_cancel;
private Button button_printer;
private Label label_top;
private Label label_right;
private Label label_bottom;
private TextBox textbox_left;
private TextBox textbox_top;
private TextBox textbox_right;
private TextBox textbox_bottom;
private ComboBox combobox_source;
private ComboBox combobox_size;
#endregion // Local variables
#region Public Constructors
public PageSetupDialog () {
InitializeComponent();
}
#endregion // Public Constructors
#region Public Instance Methods
public override void Reset () {
}
#endregion // Public Instance Methods
#region Public Instance Properties
public bool AllowMargins {
get { return allow_margins; }
set { allow_margins = value; }
}
public bool AllowOrientation {
get { return allow_orientation; }
set { allow_orientation = value; }
}
public bool AllowPaper {
get { return allow_paper; }
set { allow_paper = value; }
}
public bool AllowPrinter {
get { return allow_printer; }
set { allow_printer = value; }
}
public PrintDocument Document {
get { return document; }
set { document = value; }
}
public Margins MinMargins {
get { return min_margins; }
set { min_margins = value; }
}
public PageSettings PageSettings {
get { return page_settings; }
set { page_settings = value; }
}
public PrinterSettings PrinterSettings {
get { return printer_settings; }
set { printer_settings = value; }
}
public bool ShowHelp {
get { return show_help; }
set { show_help = value; }
}
public bool ShowNetwork {
get { return show_network; }
set { show_network = value; }
}
#endregion // Public Instance Properties
#region Protected Instance Methods
protected override bool RunDialog (IntPtr hwnd) {
return true;
}
#endregion // Protected Instance Methods
#region Private Helper
private void InitializeComponent() {
this.groupbox_paper = new System.Windows.Forms.GroupBox();
this.combobox_source = new System.Windows.Forms.ComboBox();
this.combobox_size = new System.Windows.Forms.ComboBox();
this.label_source = new System.Windows.Forms.Label();
this.label_size = new System.Windows.Forms.Label();
this.groupbox_orientation = new System.Windows.Forms.GroupBox();
this.radio_landscape = new System.Windows.Forms.RadioButton();
this.radio_portrait = new System.Windows.Forms.RadioButton();
this.groupbox_margin = new System.Windows.Forms.GroupBox();
this.label_left = new System.Windows.Forms.Label();
this.button_ok = new System.Windows.Forms.Button();
this.button_cancel = new System.Windows.Forms.Button();
this.button_printer = new System.Windows.Forms.Button();
this.label_top = new System.Windows.Forms.Label();
this.label_right = new System.Windows.Forms.Label();
this.label_bottom = new System.Windows.Forms.Label();
this.textbox_left = new System.Windows.Forms.TextBox();
this.textbox_top = new System.Windows.Forms.TextBox();
this.textbox_right = new System.Windows.Forms.TextBox();
this.textbox_bottom = new System.Windows.Forms.TextBox();
this.groupbox_paper.SuspendLayout();
this.groupbox_orientation.SuspendLayout();
this.groupbox_margin.SuspendLayout();
form.SuspendLayout();
//
// groupbox_paper
//
this.groupbox_paper.Controls.Add(this.combobox_source);
this.groupbox_paper.Controls.Add(this.combobox_size);
this.groupbox_paper.Controls.Add(this.label_source);
this.groupbox_paper.Controls.Add(this.label_size);
this.groupbox_paper.Location = new System.Drawing.Point(12, 157);
this.groupbox_paper.Name = "groupbox_paper";
this.groupbox_paper.Size = new System.Drawing.Size(336, 90);
this.groupbox_paper.TabIndex = 0;
this.groupbox_paper.TabStop = false;
this.groupbox_paper.Text = "Paper";
//
// combobox_source
//
this.combobox_source.Location = new System.Drawing.Point(84, 54);
this.combobox_source.Name = "combobox_source";
this.combobox_source.Size = new System.Drawing.Size(240, 21);
this.combobox_source.TabIndex = 3;
this.combobox_source.Text = "Default";
//
// combobox_size
//
this.combobox_size.ItemHeight = 13;
this.combobox_size.Location = new System.Drawing.Point(84, 22);
this.combobox_size.Name = "combobox_size";
this.combobox_size.Size = new System.Drawing.Size(240, 21);
this.combobox_size.TabIndex = 2;
this.combobox_size.Text = "A4";
//
// label_source
//
this.label_source.Location = new System.Drawing.Point(10, 58);
this.label_source.Name = "label_source";
this.label_source.Size = new System.Drawing.Size(48, 16);
this.label_source.TabIndex = 1;
this.label_source.Text = "&Source:";
//
// label_size
//
this.label_size.Location = new System.Drawing.Point(10, 25);
this.label_size.Name = "label_size";
this.label_size.Size = new System.Drawing.Size(52, 16);
this.label_size.TabIndex = 0;
this.label_size.Text = "Si&ze:";
//
// groupbox_orientation
//
this.groupbox_orientation.Controls.Add(this.radio_landscape);
this.groupbox_orientation.Controls.Add(this.radio_portrait);
this.groupbox_orientation.Location = new System.Drawing.Point(12, 255);
this.groupbox_orientation.Name = "groupbox_orientation";
this.groupbox_orientation.Size = new System.Drawing.Size(96, 90);
this.groupbox_orientation.TabIndex = 1;
this.groupbox_orientation.TabStop = false;
this.groupbox_orientation.Text = "Orientation";
//
// radio_landscape
//
this.radio_landscape.Location = new System.Drawing.Point(13, 52);
this.radio_landscape.Name = "radio_landscape";
this.radio_landscape.Size = new System.Drawing.Size(80, 24);
this.radio_landscape.TabIndex = 7;
this.radio_landscape.Text = "L&andscape";
//
// radio_portrait
//
this.radio_portrait.Location = new System.Drawing.Point(13, 19);
this.radio_portrait.Name = "radio_portrait";
this.radio_portrait.Size = new System.Drawing.Size(72, 24);
this.radio_portrait.TabIndex = 6;
this.radio_portrait.Text = "P&ortrait";
//
// groupbox_margin
//
this.groupbox_margin.Controls.Add(this.textbox_bottom);
this.groupbox_margin.Controls.Add(this.textbox_right);
this.groupbox_margin.Controls.Add(this.textbox_top);
this.groupbox_margin.Controls.Add(this.textbox_left);
this.groupbox_margin.Controls.Add(this.label_bottom);
this.groupbox_margin.Controls.Add(this.label_right);
this.groupbox_margin.Controls.Add(this.label_top);
this.groupbox_margin.Controls.Add(this.label_left);
this.groupbox_margin.Location = new System.Drawing.Point(120, 255);
this.groupbox_margin.Name = "groupbox_margin";
this.groupbox_margin.Size = new System.Drawing.Size(228, 90);
this.groupbox_margin.TabIndex = 2;
this.groupbox_margin.TabStop = false;
this.groupbox_margin.Text = "Margins (inches)";
//
// label_left
//
this.label_left.Location = new System.Drawing.Point(10, 25);
this.label_left.Name = "label_left";
this.label_left.Size = new System.Drawing.Size(40, 23);
this.label_left.TabIndex = 0;
this.label_left.Text = "&Left:";
//
// button_ok
//
this.button_ok.Location = new System.Drawing.Point(120, 358);
this.button_ok.Name = "button_ok";
this.button_ok.Size = new System.Drawing.Size(72, 23);
this.button_ok.TabIndex = 3;
this.button_ok.Text = "OK";
//
// button_cancel
//
this.button_cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.button_cancel.Location = new System.Drawing.Point(198, 358);
this.button_cancel.Name = "button_cancel";
this.button_cancel.Size = new System.Drawing.Size(72, 23);
this.button_cancel.TabIndex = 4;
this.button_cancel.Text = "Cancel";
//
// button_printer
//
this.button_printer.Location = new System.Drawing.Point(276, 358);
this.button_printer.Name = "button_printer";
this.button_printer.Size = new System.Drawing.Size(72, 23);
this.button_printer.TabIndex = 5;
this.button_printer.Text = "&Printer...";
//
// label_top
//
this.label_top.Location = new System.Drawing.Point(10, 57);
this.label_top.Name = "label_top";
this.label_top.Size = new System.Drawing.Size(40, 23);
this.label_top.TabIndex = 1;
this.label_top.Text = "&Top:";
//
// label_right
//
this.label_right.Location = new System.Drawing.Point(124, 25);
this.label_right.Name = "label_right";
this.label_right.Size = new System.Drawing.Size(40, 23);
this.label_right.TabIndex = 2;
this.label_right.Text = "&Right:";
//
// label_bottom
//
this.label_bottom.Location = new System.Drawing.Point(124, 57);
this.label_bottom.Name = "label_bottom";
this.label_bottom.Size = new System.Drawing.Size(40, 23);
this.label_bottom.TabIndex = 3;
this.label_bottom.Text = "&Bottom:";
//
// textbox_left
//
this.textbox_left.Location = new System.Drawing.Point(57, 21);
this.textbox_left.Name = "textbox_left";
this.textbox_left.Size = new System.Drawing.Size(48, 20);
this.textbox_left.TabIndex = 4;
this.textbox_left.Text = "1";
//
// textbox_top
//
this.textbox_top.Location = new System.Drawing.Point(57, 54);
this.textbox_top.Name = "textbox_top";
this.textbox_top.Size = new System.Drawing.Size(48, 20);
this.textbox_top.TabIndex = 5;
this.textbox_top.Text = "1";
//
// textbox_right
//
this.textbox_right.Location = new System.Drawing.Point(171, 21);
this.textbox_right.Name = "textbox_right";
this.textbox_right.Size = new System.Drawing.Size(48, 20);
this.textbox_right.TabIndex = 6;
this.textbox_right.Text = "1";
//
// textbox_bottom
//
this.textbox_bottom.Location = new System.Drawing.Point(171, 54);
this.textbox_bottom.Name = "textbox_bottom";
this.textbox_bottom.Size = new System.Drawing.Size(48, 20);
this.textbox_bottom.TabIndex = 7;
this.textbox_bottom.Text = "1";
//
// Form3
//
form.AcceptButton = this.button_ok;
form.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
form.CancelButton = this.button_cancel;
form.ClientSize = new System.Drawing.Size(360, 390);
form.Controls.Add(this.button_printer);
form.Controls.Add(this.button_cancel);
form.Controls.Add(this.button_ok);
form.Controls.Add(this.groupbox_margin);
form.Controls.Add(this.groupbox_orientation);
form.Controls.Add(this.groupbox_paper);
form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
form.HelpButton = true;
form.MaximizeBox = false;
form.MinimizeBox = false;
form.Name = "Form3";
form.ShowInTaskbar = false;
form.Text = "Page Setup";
this.groupbox_paper.ResumeLayout(false);
this.groupbox_orientation.ResumeLayout(false);
this.groupbox_margin.ResumeLayout(false);
form.ResumeLayout(false);
}
#endregion // Private Helper
}
}
|