Beispiel #1
0
        private void CreateFormControls()
        {
            form.SuspendLayout();

            GroupBox group_box_prn = new GroupBox();

            group_box_prn.Location = new Point(10, 8);
            group_box_prn.Text     = "Printer";
            group_box_prn.Size     = new Size(420, 145);

            GroupBox group_box_range = new GroupBox();

            group_box_range.Location = new Point(10, 155);
            group_box_range.Text     = "Print range";
            group_box_range.Size     = new Size(240, 100);

            GroupBox group_box_copies = new GroupBox();

            group_box_copies.Location = new Point(265, 155);
            group_box_copies.Text     = "Copies";
            group_box_copies.Size     = new Size(165, 100);

            // Accept button
            accept_button           = new Button();
            form.AcceptButton       = accept_button;
            accept_button.Anchor    = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right)));
            accept_button.FlatStyle = FlatStyle.System;
            accept_button.Location  = new Point(265, 270);
            accept_button.Text      = "OK";
            accept_button.FlatStyle = FlatStyle.System;
            accept_button.Click    += new EventHandler(OnClickOkButton);

            // Cancel button
            cancel_button           = new Button();
            form.CancelButton       = cancel_button;
            cancel_button.Anchor    = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right)));
            cancel_button.FlatStyle = FlatStyle.System;
            cancel_button.Location  = new Point(350, 270);
            cancel_button.Text      = "Cancel";
            cancel_button.FlatStyle = FlatStyle.System;
            cancel_button.Click    += new EventHandler(OnClickCancelButton);

            // Static controls
            Label label = new Label();

            label.AutoSize = true;
            label.Text     = "&Name:";
            label.Location = new Point(20, 33);
            group_box_prn.Controls.Add(label);

            label          = new Label();
            label.Text     = "Status:";
            label.AutoSize = true;
            label.Location = new Point(20, 60);
            group_box_prn.Controls.Add(label);

            label_status          = new Label();
            label_status.AutoSize = true;
            label_status.Location = new Point(80, 60);
            group_box_prn.Controls.Add(label_status);

            label          = new Label();
            label.Text     = "Type:";
            label.AutoSize = true;
            label.Location = new Point(20, 80);
            group_box_prn.Controls.Add(label);

            label_type          = new Label();
            label_type.AutoSize = true;
            label_type.Location = new Point(80, 80);
            group_box_prn.Controls.Add(label_type);

            label          = new Label();
            label.Text     = "Where:";
            label.AutoSize = true;
            label.Location = new Point(20, 100);
            group_box_prn.Controls.Add(label);

            label_where          = new Label();
            label_where.AutoSize = true;
            label_where.Location = new Point(80, 100);
            group_box_prn.Controls.Add(label_where);

            label          = new Label();
            label.Text     = "Comment:";
            label.AutoSize = true;
            label.Location = new Point(20, 120);
            group_box_prn.Controls.Add(label);

            label_comment          = new Label();
            label_comment.AutoSize = true;
            label_comment.Location = new Point(80, 120);
            group_box_prn.Controls.Add(label_comment);

            radio_all          = new RadioButton();
            radio_all.TabIndex = 21;
            radio_all.Location = new Point(20, 20);
            radio_all.Text     = "&All";
            radio_all.Checked  = true;
            group_box_range.Controls.Add(radio_all);

            radio_pages                 = new RadioButton();
            radio_pages.TabIndex        = 22;
            radio_pages.Location        = new Point(20, 46);
            radio_pages.Text            = "Pa&ges";
            radio_pages.Width           = 60;
            radio_pages.CheckedChanged += new EventHandler(OnPagesCheckedChanged);
            group_box_range.Controls.Add(radio_pages);

            radio_sel          = new RadioButton();
            radio_sel.TabIndex = 23;
            radio_sel.Location = new Point(20, 72);
            radio_sel.Text     = "&Selection";
            group_box_range.Controls.Add(radio_sel);

            labelFrom          = new Label();
            labelFrom.Text     = "&from:";
            labelFrom.TabIndex = 24;
            labelFrom.AutoSize = true;
            labelFrom.Location = new Point(80, 50);
            group_box_range.Controls.Add(labelFrom);

            txtFrom              = new TextBox();
            txtFrom.TabIndex     = 25;
            txtFrom.Location     = new Point(120, 50);
            txtFrom.Width        = 40;
            txtFrom.TextChanged += new EventHandler(OnPagesTextChanged);
            group_box_range.Controls.Add(txtFrom);

            labelTo          = new Label();
            labelTo.Text     = "&to:";
            labelTo.TabIndex = 26;
            labelTo.AutoSize = true;
            labelTo.Location = new Point(170, 50);
            group_box_range.Controls.Add(labelTo);

            txtTo              = new TextBox();
            txtTo.TabIndex     = 27;
            txtTo.Location     = new Point(190, 50);
            txtTo.Width        = 40;
            txtTo.TextChanged += new EventHandler(OnPagesTextChanged);
            group_box_range.Controls.Add(txtTo);

            chkbox_print          = new CheckBox();
            chkbox_print.Location = new Point(305, 115);
            chkbox_print.Text     = "Print to fil&e";


            updown_copies          = new NumericUpDown();
            updown_copies.TabIndex = 31;
            updown_copies.Location = new Point(105, 18);
            updown_copies.Minimum  = 1;
            group_box_copies.Controls.Add(updown_copies);
            updown_copies.ValueChanged += new System.EventHandler(OnUpDownValueChanged);
            updown_copies.Size          = new System.Drawing.Size(40, 20);

            label          = new Label();
            label.Text     = "Number of &copies:";
            label.AutoSize = true;
            label.Location = new Point(10, 20);
            group_box_copies.Controls.Add(label);

            chkbox_collate                 = new CheckBox();
            chkbox_collate.TabIndex        = 32;
            chkbox_collate.Location        = new Point(105, 55);
            chkbox_collate.Text            = "C&ollate";
            chkbox_collate.Width           = 58;
            chkbox_collate.CheckedChanged += new EventHandler(chkbox_collate_CheckedChanged);

            group_box_copies.Controls.Add(chkbox_collate);

            collate          = new CollatePreview();
            collate.Location = new Point(6, 50);
            collate.Size     = new Size(100, 45);
            group_box_copies.Controls.Add(collate);



            // Printer combo
            printer_combo = new ComboBox();
            printer_combo.DropDownStyle         = ComboBoxStyle.DropDownList;
            printer_combo.Location              = new Point(80, 32);
            printer_combo.Width                 = 220;
            printer_combo.SelectedIndexChanged += new EventHandler(OnPrinterSelectedIndexChanged);

            default_printer_settings = new PrinterSettings();
            for (int i = 0; i < installed_printers.Count; i++)
            {
                printer_combo.Items.Add(installed_printers[i]);
                if (installed_printers[i] == default_printer_settings.PrinterName)
                {
                    printer_combo.SelectedItem = installed_printers[i];
                }
            }
            printer_combo.TabIndex = 11;
            chkbox_print.TabIndex  = 12;
            group_box_prn.Controls.Add(printer_combo);
            group_box_prn.Controls.Add(chkbox_print);

            form.Size                 = new Size(450, 327); // 384
            form.FormBorderStyle      = FormBorderStyle.FixedDialog;
            form.MaximizeBox          = false;
            group_box_prn.TabIndex    = 10;
            group_box_range.TabIndex  = 20;
            group_box_copies.TabIndex = 30;
            accept_button.TabIndex    = 40;
            cancel_button.TabIndex    = 50;
            form.Controls.Add(group_box_prn);
            form.Controls.Add(group_box_range);
            form.Controls.Add(group_box_copies);
            form.Controls.Add(accept_button);
            form.Controls.Add(cancel_button);
            form.ResumeLayout(false);
        }
Beispiel #2
0
		private void CreateFormControls ()
		{
			form.SuspendLayout ();

			GroupBox group_box_prn = new GroupBox ();
			group_box_prn.Location = new Point (10, 8);
			group_box_prn.Text = "Printer";
			group_box_prn.Size = new Size (420, 145);

			GroupBox group_box_range = new GroupBox ();
			group_box_range.Location = new Point (10, 155);
			group_box_range.Text = "Print range";
			group_box_range.Size = new Size (240, 100);

			GroupBox group_box_copies = new GroupBox ();
			group_box_copies.Location = new Point (265, 155);
			group_box_copies.Text = "Copies";
			group_box_copies.Size = new Size (165, 100);

			// Accept button
			accept_button = new Button ();
			form.AcceptButton = accept_button;
			accept_button.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right)));
			accept_button.FlatStyle = FlatStyle.System;
			accept_button.Location = new Point (265, 270);
			accept_button.Text = "OK";
			accept_button.FlatStyle = FlatStyle.System;
			accept_button.Click += new EventHandler (OnClickOkButton);

			// Cancel button
			cancel_button = new Button ();
			form.CancelButton = cancel_button;
			cancel_button.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right)));
			cancel_button.FlatStyle = FlatStyle.System;
			cancel_button.Location = new Point (350, 270);
			cancel_button.Text = "Cancel";
			cancel_button.FlatStyle = FlatStyle.System;
			cancel_button.Click += new EventHandler (OnClickCancelButton);

			// Static controls
			Label label = new Label ();
			label.AutoSize = true;
			label.Text = "&Name:";
			label.Location = new Point (20, 33);
			group_box_prn.Controls.Add (label);

			label = new Label ();
			label.Text = "Status:";
			label.AutoSize = true;
			label.Location = new Point (20, 60);
			group_box_prn.Controls.Add (label);

			label_status = new Label ();
			label_status.AutoSize = true;
			label_status.Location = new Point (80, 60);
			group_box_prn.Controls.Add (label_status);

			label = new Label ();
			label.Text = "Type:";
			label.AutoSize = true;
			label.Location = new Point (20, 80);
			group_box_prn.Controls.Add (label);

			label_type = new Label ();
			label_type.AutoSize = true;
			label_type.Location = new Point (80, 80);
			group_box_prn.Controls.Add (label_type);

			label = new Label ();
			label.Text = "Where:";
			label.AutoSize = true;
			label.Location = new Point (20, 100);
			group_box_prn.Controls.Add (label);
			
			label_where = new Label ();
			label_where.AutoSize = true;
			label_where.Location = new Point (80, 100);
			group_box_prn.Controls.Add (label_where);

			label = new Label ();
			label.Text = "Comment:";
			label.AutoSize = true;
			label.Location = new Point (20, 120);
			group_box_prn.Controls.Add (label);

			label_comment = new Label ();
			label_comment.AutoSize = true;
			label_comment.Location = new Point (80, 120);
			group_box_prn.Controls.Add (label_comment);

			radio_all = new RadioButton ();
			radio_all.TabIndex = 21;
			radio_all.Location = new Point (20, 20);
			radio_all.Text = "&All";
			radio_all.Checked = true;
			group_box_range.Controls.Add (radio_all);

			radio_pages = new RadioButton ();
			radio_pages.TabIndex = 22;
			radio_pages.Location = new Point (20, 46);
			radio_pages.Text = "Pa&ges";
			radio_pages.Width = 60;
			radio_pages.CheckedChanged += new EventHandler (OnPagesCheckedChanged);
			group_box_range.Controls.Add (radio_pages);

			radio_sel = new RadioButton ();
			radio_sel.TabIndex = 23;
			radio_sel.Location = new Point (20, 72);
			radio_sel.Text = "&Selection";
			group_box_range.Controls.Add (radio_sel);

			labelFrom = new Label ();
			labelFrom.Text = "&from:";
			labelFrom.TabIndex = 24;
			labelFrom.AutoSize = true;
			labelFrom.Location = new Point (80, 50);
			group_box_range.Controls.Add (labelFrom);

			txtFrom = new TextBox ();
			txtFrom.TabIndex = 25;
			txtFrom.Location = new Point (120, 50);
			txtFrom.Width = 40;
			txtFrom.TextChanged += new EventHandler (OnPagesTextChanged);
			group_box_range.Controls.Add (txtFrom);

			labelTo = new Label ();
			labelTo.Text = "&to:";
			labelTo.TabIndex = 26;
			labelTo.AutoSize = true;
			labelTo.Location = new Point (170, 50);
			group_box_range.Controls.Add (labelTo);

			txtTo = new TextBox ();
			txtTo.TabIndex = 27;
			txtTo.Location = new Point (190, 50);
			txtTo.Width = 40;
			txtTo.TextChanged += new EventHandler (OnPagesTextChanged);
			group_box_range.Controls.Add (txtTo);

			chkbox_print = new CheckBox ();
			chkbox_print.Location = new Point (305, 115);
			chkbox_print.Text = "Print to fil&e";


			updown_copies = new NumericUpDown ();
			updown_copies.TabIndex = 31;
			updown_copies.Location = new Point (105, 18);
			updown_copies.Minimum = 1;
			group_box_copies.Controls.Add (updown_copies);
			updown_copies.ValueChanged += new System.EventHandler (OnUpDownValueChanged);
			updown_copies.Size = new System.Drawing.Size (40, 20);

			label = new Label ();
			label.Text = "Number of &copies:";
			label.AutoSize = true;
			label.Location = new Point (10, 20);
			group_box_copies.Controls.Add (label);

			chkbox_collate = new CheckBox ();
			chkbox_collate.TabIndex = 32;
			chkbox_collate.Location = new Point (105, 55);
			chkbox_collate.Text = "C&ollate";
			chkbox_collate.Width = 58;
			chkbox_collate.CheckedChanged += new EventHandler(chkbox_collate_CheckedChanged);
		
			group_box_copies.Controls.Add (chkbox_collate);

			collate = new CollatePreview ();
			collate.Location = new Point (6, 50);
			collate.Size = new Size (100, 45);
			group_box_copies.Controls.Add (collate);
			


			// Printer combo
			printer_combo = new ComboBox ();
			printer_combo.DropDownStyle = ComboBoxStyle.DropDownList;
			printer_combo.Location = new Point (80, 32);
			printer_combo.Width = 220;
			printer_combo.SelectedIndexChanged += new EventHandler (OnPrinterSelectedIndexChanged);

			default_printer_settings = new PrinterSettings ();
			for (int i = 0; i < installed_printers.Count; i++) {
				printer_combo.Items.Add (installed_printers[i]);
				if (installed_printers[i] == default_printer_settings.PrinterName)
					printer_combo.SelectedItem = installed_printers[i];
			}
			printer_combo.TabIndex = 11;
			chkbox_print.TabIndex = 12;
			group_box_prn.Controls.Add (printer_combo);
			group_box_prn.Controls.Add (chkbox_print);

			form.Size =  new Size (450, 327); // 384
			form.FormBorderStyle = FormBorderStyle.FixedDialog;
			form.MaximizeBox = false;
			group_box_prn.TabIndex = 10;
			group_box_range.TabIndex = 20;
			group_box_copies.TabIndex = 30;
			accept_button.TabIndex = 40;
			cancel_button.TabIndex = 50;
			form.Controls.Add (group_box_prn);
			form.Controls.Add (group_box_range);
			form.Controls.Add (group_box_copies);
			form.Controls.Add (accept_button);
			form.Controls.Add (cancel_button);
			form.ResumeLayout (false);
		}