public override void SetupView() { // Setup label text sectionTitleLabel.Text = "Edit Selected Parameter:"; sectionTitleLabel.SetBounds( 0, 0, 150, 20); parameter_name_label.Text = "Parameter:"; parameter_name_label.SetBounds( sectionTitleLabel.Left, sectionTitleLabel.Top + sectionTitleLabel.Height + padding, 100, 20); parameter_value_label.Text = "Value:"; parameter_value_label.SetBounds( parameter_name_label.Left, parameter_name_label.Top + parameter_name_label.Height + 5, 100, 20); // Setup text boxes parameterNameTextbox.SetBounds( parameter_name_label.Width + 5, parameter_name_label.Top, 140, 20); parameterValueTextbox.SetBounds( parameterNameTextbox.Left, parameter_value_label.Top, 140, 20); // Setup button submitButton.Text = "Save"; submitButton.SetBounds( parameterValueTextbox.Left, parameterValueTextbox.Top + parameterValueTextbox.Height + 5, 140, 20); // Setup width & height this.Width = margin + parameter_name_label.Width + padding + parameterNameTextbox.Width + margin; this.Height = margin + sectionTitleLabel.Height + padding + parameter_name_label.Height + padding + parameterNameTextbox.Height + padding + submitButton.Height + margin; }
public static DialogResult InputBox(string title, string promptText, ref string value) { Form form = new Form(); Label label = new Label(); MaskedTextBox textBox = new MaskedTextBox(); textBox.Text = value; SimpleButton buttonOk = new SimpleButton(); SimpleButton buttonCancel = new SimpleButton(); form.Text = title; label.Text = promptText; textBox.Text = value; buttonOk.Text = "Qəbul"; buttonCancel.Text = "İmtina"; buttonOk.DialogResult = DialogResult.OK; buttonCancel.DialogResult = DialogResult.Cancel; label.SetBounds(9, 20, 372, 13); textBox.SetBounds(12, 36, 372, 20); buttonOk.SetBounds(228, 72, 75, 23); buttonCancel.SetBounds(309, 72, 75, 23); label.AutoSize = true; textBox.Anchor = textBox.Anchor | AnchorStyles.Right; buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; form.ClientSize = new Size(396, 107); form.Controls.AddRange(new Control[] { label, textBox, buttonOk, buttonCancel }); form.ClientSize = new Size(Math.Max(300, label.Right + 10), form.ClientSize.Height); form.FormBorderStyle = FormBorderStyle.FixedDialog; form.StartPosition = FormStartPosition.CenterScreen; form.MinimizeBox = false; form.MaximizeBox = false; form.AcceptButton = buttonOk; form.CancelButton = buttonCancel; DialogResult dialogResult = form.ShowDialog(); value = textBox.Text; return(dialogResult); }
private List <Control> controls = new List <Control>(); // List of Controls to hide/show when Select is visible/not visible // Constructor public SelectSearch(TextBoxBase s, Object[] data) { source = s; // The TextBoxBase Control the user has selected items = data; // The items to use in the listbox // Change properties of source source.ReadOnly = true; source.BackColor = Color.White; // Grab the Coordinates of the source element int x = source.Location.X; int y = source.Location.Y + source.Height + 1; // Filter Properties filter.Mask = "D00000"; filter.MouseClick += new MouseEventHandler(filter_MouseClick); // move cursor to start of text filter.TextChanged += new EventHandler(filter_TextChanged); // Do something when the filter's text has changed filter.SetBounds(2, 2, source.Width - 4, source.Height); // subtract 2 * the x position of this, which is 2, from width filter.SelectionStart = 1; panel.Controls.Add(filter); // ListBox Properties list.Items.AddRange(items.ToArray()); list.SelectedIndexChanged += new EventHandler(list_SelectedIndexChanged); list.Click += new EventHandler(list_Click); list.SetBounds(2, 4 + source.Height, source.Width - 4, filter.Width - filter.Height); // Panel Properties panel.SetBounds(x, y, source.Width, source.Width); panel.BackColor = source.Parent.BackColor; panel.Controls.Add(list); panel.Click += new EventHandler(panel_Click); panel.Visible = false; // Finally source.Parent.Controls.Add(panel); }
public override void SetupView() { // Set GUI controls dimensions & positions // Setup labels TitleLabel.Text = "Add New Brew:"; TitleLabel.SetBounds( margin, margin, 150, 30); brandLabel.Text = "Brand:"; brandLabel.SetBounds( margin, TitleLabel.Top + TitleLabel.Height + padding, 100, 20); dateLabel.Text = "Date:"; dateLabel.SetBounds( margin, brandLabel.Top + brandLabel.Height + padding, 100, 20); brewNumberLabel.Text = "BrewNumber:"; brewNumberLabel.SetBounds( margin, dateLabel.Top + dateLabel.Height + padding, 100, 20); // Setup textboxes brandNameTextBox.SetBounds( brandLabel.Left + brandLabel.Width + padding, brandLabel.Top, 150, 20); dateTextBox.SetBounds( dateLabel.Left + dateLabel.Width + padding, dateLabel.Top, 150, 20); brewNumberTextBox.SetBounds( brewNumberLabel.Left + brewNumberLabel.Width + padding, brewNumberLabel.Top, 150, 20); // Setup button startNewBrewButton.Text = "Start Brew"; startNewBrewButton.SetBounds( brewNumberTextBox.Left, brewNumberTextBox.Top + brewNumberTextBox.Height + padding, 150, 20); // Setup width & height this.Width = margin + brandLabel.Width + padding + brandNameTextBox.Width + margin; this.Height = margin + TitleLabel.Height + padding + brandNameTextBox.Height + padding + dateTextBox.Height + padding + brewNumberTextBox.Height + padding + startNewBrewButton.Height + margin; }
// Methods public override void SetupView() { // Set GUI controls dimensions & positions // Setup labels TitleLabel.Text = "Create Report:"; TitleLabel.SetBounds( margin, margin, 150, 30); yearLabel.Text = "Year:"; yearLabel.SetBounds( margin, margin + TitleLabel.Height + padding, 100, 20); monthLabel.Text = "Month:"; monthLabel.SetBounds( margin, yearLabel.Top + yearLabel.Height + padding, 100, 20); locationLabel.Text = "Location:"; locationLabel.SetBounds( margin, monthLabel.Top + monthLabel.Height + padding, 100, 20); reportNameLabel.Text = "ReportName:"; reportNameLabel.SetBounds( margin, locationLabel.Top + locationLabel.Height + padding, 100, 20); // Setup textboxes yearTextBox.SetBounds( yearLabel.Left + yearLabel.Width + padding, yearLabel.Top, 50, 20); monthTextBox.SetBounds( monthLabel.Left + monthLabel.Width + padding, monthLabel.Top, 100, 20); locationTextBox.SetBounds( locationLabel.Left + locationLabel.Width + padding, locationLabel.Top, 150, 20); reportNameTextBox.SetBounds( reportNameLabel.Left + reportNameLabel.Width + padding, reportNameLabel.Top, 150, 20); //Setup buttons setLocationButton.Text = "Set"; setLocationButton.SetBounds( locationTextBox.Left + locationTextBox.Width + padding, locationTextBox.Top, 50, 20); createReportButton.Text = "Create"; createReportButton.SetBounds( reportNameTextBox.Left, reportNameTextBox.Top + reportNameTextBox.Height + padding, 150, 20); //Setup Folder Dialog folderBrowser.Description = "Select the Directory where you want to save the report."; // Setup width & height this.Width = margin + locationLabel.Width + padding + locationTextBox.Width + padding + setLocationButton.Width + margin; this.Height = margin + TitleLabel.Height + padding + yearTextBox.Height + padding + monthTextBox.Height + padding + locationTextBox.Height + padding + reportNameTextBox.Height + padding + createReportButton.Height + margin; }