protected override void OnDrawColumnHeader(DrawListViewColumnHeaderEventArgs e) { base.OnDrawColumnHeader(e); if (e.ColumnIndex == 0) { var headerCheckBox = new CheckBox {Text = "", Visible = true}; SuspendLayout(); e.DrawBackground(); headerCheckBox.BackColor = Color.Transparent; headerCheckBox.UseVisualStyleBackColor = true; headerCheckBox.BackgroundImage = Resources.ListViewHeaderCheckboxBackgroud; headerCheckBox.SetBounds(e.Bounds.X, e.Bounds.Y, headerCheckBox.GetPreferredSize(new Size(e.Bounds.Width, e.Bounds.Height)). Width, headerCheckBox.GetPreferredSize(new Size(e.Bounds.Width, e.Bounds.Height)). Height); headerCheckBox.Size = new Size(headerCheckBox.GetPreferredSize(new Size(e.Bounds.Width - 1, e.Bounds.Height)).Width + 1, e.Bounds.Height); headerCheckBox.Location = new Point(4, 0); Controls.Add(headerCheckBox); headerCheckBox.Show(); headerCheckBox.BringToFront(); e.DrawText(TextFormatFlags.VerticalCenter | TextFormatFlags.Left); headerCheckBox.CheckedChanged += OnHeaderCheckboxCheckedChanged; ResumeLayout(true); } else { e.DrawDefault = true; } }
public DialogResult CatBox(string promptText, double cost, DateTime dt, ref string value) { Form form = new Form(); Label label = new Label(); Label amount = new Label(); Label date = new Label(); ComboBox comboBox = new ComboBox(); Button buttonOk = new Button(); CheckBox checkBox = new CheckBox(); form.Text = "Specify a Category:"; label.Text = promptText; amount.Text = cost.ToString("C"); date.Text = dt.ToString(); checkBox.Text = "Remember this relationship?"; buttonOk.Text = "OK"; buttonOk.DialogResult = DialogResult.OK; label.SetBounds(9, 20, 172, 13); amount.SetBounds(273, 20, 100, 13); date.SetBounds(173, 20, 100, 13); comboBox.SetBounds(12, 36, 372, 20); buttonOk.SetBounds(309, 72, 75, 23); checkBox.SetBounds(12, 72, 275, 24); // ??? label.AutoSize = true; comboBox.Anchor = comboBox.Anchor | AnchorStyles.Right; buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; checkBox.Anchor = checkBox.Anchor | AnchorStyles.Right; comboBox.DropDownStyle = ComboBoxStyle.DropDownList; form.ClientSize = new Size(396, 107); form.Controls.AddRange(new Control[] { label, amount, date, checkBox, comboBox, buttonOk }); form.ClientSize = new Size(Math.Max(300, amount.Right + 10), form.ClientSize.Height); form.FormBorderStyle = FormBorderStyle.FixedDialog; form.StartPosition = FormStartPosition.CenterScreen; form.MinimizeBox = false; form.MaximizeBox = false; form.AcceptButton = buttonOk; SqlCeConnection cs = new SqlCeConnection(@"Data Source = Expenses.sdf"); cs.Open(); SqlCeDataReader r = null; SqlCeCommand getCats = new SqlCeCommand("SELECT * FROM Categories", cs); r = getCats.ExecuteReader(); while (r.Read()) comboBox.Items.Add(r["Category"]); cs.Close(); DialogResult dialogResult = form.ShowDialog(); value = comboBox.Text; // remember relationship if option to do so is checked if (checkBox.Checked) { SqlCeConnection cs2 = new SqlCeConnection(@"Data Source = Expenses.sdf"); cs2.Open(); SqlCeCommand setCat = new SqlCeCommand("INSERT INTO CategorizedItems VALUES (@Description, @Category)", cs2); setCat.Parameters.AddWithValue("@Description", promptText); setCat.Parameters.AddWithValue("@Category", value); setCat.ExecuteNonQuery(); cs2.Close(); } return dialogResult; }
/// <summary> /// Displays a dialog with a prompt and textbox where the user can enter information /// </summary> /// <param name="title">Dialog title</param> /// <param name="promptText">Dialog prompt</param> /// <param name="value">Sets the initial value and returns the result</param> /// <returns>Dialog result</returns> public static DialogResult Show(Form parent, string title, string promptText, string checkText, ref string value, ref bool isChecked) { // TODO: button placement/size has been hardcoded for how it is used in this app. Form form = new Form(); Label label = new Label(); TextBox textBox = new TextBox(); Button buttonOk = new Button(); Button buttonCancel = new Button(); CheckBox checkBox = new CheckBox(); form.Text = title; label.Text = promptText; textBox.Text = value; textBox.Multiline = true; textBox.Height = (int)(textBox.Height * 2); checkBox.Checked = isChecked; checkBox.Text = checkText; checkBox.Visible = (checkText != null); //form.TopLevel = true; //form.StartPosition = FormStartPosition.CenterParent; //form.Parent = parent; buttonOk.Text = "OK"; buttonCancel.Text = "Cancel"; buttonOk.DialogResult = DialogResult.OK; buttonCancel.DialogResult = DialogResult.Cancel; label.SetBounds(9, 20, 372, 13); textBox.SetBounds(12, 76, 372, 50); buttonOk.SetBounds(228, 130, 75, 23); buttonCancel.SetBounds(309, 130, 75, 23); checkBox.SetBounds(12, 60, 150, 23); label.AutoSize = true; textBox.Anchor = textBox.Anchor | AnchorStyles.Right; buttonOk.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; buttonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; checkBox.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; form.ClientSize = new Size(396, 170); form.Controls.AddRange(new Control[] { label, textBox, buttonOk, buttonCancel, checkBox }); 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; isChecked = checkBox.Checked; return dialogResult; }
public static TDSRoom InputCreateRoomBox(TDSRoom currentRoom) { var form = new Form(); var westRadioButton = new RadioButton {Text = "To the west", Enabled = false}; var eastRadioButton = new RadioButton {Text = "To the east", Enabled = false}; var northRadioButton = new RadioButton {Text = "To the north", Enabled = false}; var southRadioButton = new RadioButton {Text = "To the south", Enabled = false}; var isRequiredCheckBox = new CheckBox {Text = "Is required", Checked = true}; var isSecretCheckBox = new CheckBox {Text = "Is secret", Checked = false}; var doneButton = new Button {Text = "OK"}; form.Text = "Create new room"; form.ClientSize = new Size(396, 200); form.Controls.AddRange(new Control[] { westRadioButton, eastRadioButton, northRadioButton, southRadioButton, isRequiredCheckBox, isSecretCheckBox, doneButton }); form.FormBorderStyle = FormBorderStyle.FixedDialog; form.StartPosition = FormStartPosition.CenterScreen; form.MinimizeBox = false; form.MaximizeBox = false; westRadioButton.SetBounds(25, 25, 100, 25); eastRadioButton.SetBounds(25, 50, 100, 25); northRadioButton.SetBounds(25, 75, 100, 25); southRadioButton.SetBounds(25, 100, 100, 25); isRequiredCheckBox.SetBounds(125, 25, 100, 25); isSecretCheckBox.SetBounds(125, 50, 100, 25); doneButton.SetBounds(125, 100, 100, 25); if (currentRoom.Level.GetRoom(currentRoom.X - 1, currentRoom.Y) == null) westRadioButton.Enabled = true; if (currentRoom.Level.GetRoom(currentRoom.X + 1, currentRoom.Y) == null) eastRadioButton.Enabled = true; if (currentRoom.Level.GetRoom(currentRoom.X, currentRoom.Y - 1) == null) northRadioButton.Enabled = true; if (currentRoom.Level.GetRoom(currentRoom.X, currentRoom.Y + 1) == null) southRadioButton.Enabled = true; TDSRoom result = null; var resultX = 0; var resultY = 0; doneButton.Click += (e, sender) => { if (westRadioButton.Checked) resultX = -1; if (eastRadioButton.Checked) resultX = 1; if (northRadioButton.Checked) resultY = -1; if (southRadioButton.Checked) resultY = 1; result = TDSControl.CreateRoom(currentRoom.Level, currentRoom.X + resultX, currentRoom.Y + resultY, isRequiredCheckBox.Checked, isSecretCheckBox.Checked); form.Close(); }; form.ShowDialog(); return result; }
private void Clear_Click(object sender, EventArgs e) { Form form = new Form(); form.Text = "Clear Databases"; CheckBox clearCategories = new CheckBox(); clearCategories.Text = "Clear All Categories, Expenses, and Relations"; clearCategories.Checked = false; clearCategories.SetBounds(9, 6, 272, 24); CheckBox clearLineItems = new CheckBox(); clearLineItems.Text = "Clear Line Item Expenses Only"; clearLineItems.Checked = false; clearLineItems.SetBounds(9, 30, 272, 24); CheckBox clearRelations = new CheckBox(); clearRelations.Text = "Clear Saved Relations Only"; clearRelations.Checked = false; clearRelations.SetBounds(9, 54, 272, 24); Button OK = new Button(); OK.Text = "OK"; OK.SetBounds(9, 78, 75, 23); OK.DialogResult = DialogResult.OK; Button Cancel = new Button(); Cancel.Text = "Cancel"; Cancel.SetBounds(100, 78, 75, 23); Cancel.DialogResult = DialogResult.Cancel; form.ClientSize = new Size(296, 107); form.Controls.AddRange(new Control[] { clearCategories, clearLineItems, clearRelations, OK, Cancel }); form.FormBorderStyle = FormBorderStyle.FixedDialog; form.StartPosition = FormStartPosition.CenterScreen; form.MinimizeBox = false; form.MaximizeBox = false; form.AcceptButton = OK; form.CancelButton = Cancel; if (form.ShowDialog() == DialogResult.OK) { if (clearCategories.Checked) { File.Delete("Expenses.sdf"); Setup.Enabled = true; Edit.Enabled = false; Clear.Enabled = false; View.Enabled = false; Import.Enabled = false; Manual.Enabled = false; } else if (clearLineItems.Checked) { if (clearRelations.Checked) Form1_Helper.ClearRelations(); Form1_Helper.ClearLineItems(); } else if (clearRelations.Checked) Form1_Helper.ClearRelations(); else MessageBox.Show("No action taken."); } else MessageBox.Show("No action taken."); }
/// <include file='doc\DataGridGeneralPage.uex' path='docs/doc[@for="DataGridGeneralPage.InitForm"]/*' /> /// <devdoc> /// Initializes the UI of the form. /// </devdoc> private void InitForm() { GroupLabel dataGroup = new GroupLabel(); Label dataSourceLabel = new Label(); this.dataSourceCombo = new UnsettableComboBox(); Label dataMemberLabel = new Label(); this.dataMemberCombo = new UnsettableComboBox(); Label dataKeyFieldLabel = new Label(); this.dataKeyFieldCombo = new UnsettableComboBox(); this.columnInfoLabel = new Label(); GroupLabel headerFooterGroup = new GroupLabel(); this.showHeaderCheck = new CheckBox(); this.showFooterCheck = new CheckBox(); GroupLabel behaviorGroup = new GroupLabel(); this.allowSortingCheck = new CheckBox(); dataGroup.SetBounds(4, 4, 431, 16); dataGroup.Text = SR.GetString(SR.DGGen_DataGroup); dataGroup.TabIndex = 0; dataGroup.TabStop = false; dataSourceLabel.SetBounds(12, 24, 170, 16); dataSourceLabel.Text = SR.GetString(SR.DGGen_DataSource); dataSourceLabel.TabStop = false; dataSourceLabel.TabIndex = 1; dataSourceCombo.SetBounds(12, 40, 140, 64); dataSourceCombo.DropDownStyle = ComboBoxStyle.DropDownList; dataSourceCombo.Sorted = true; dataSourceCombo.TabIndex = 2; dataSourceCombo.NotSetText = SR.GetString(SR.DGGen_DSUnbound); dataSourceCombo.SelectedIndexChanged += new EventHandler(this.OnSelChangedDataSource); dataMemberLabel.SetBounds(184, 24, 170, 16); dataMemberLabel.Text = SR.GetString(SR.DGGen_DataMember); dataMemberLabel.TabStop = false; dataMemberLabel.TabIndex = 3; dataMemberCombo.SetBounds(184, 40, 140, 21); dataMemberCombo.DropDownStyle = ComboBoxStyle.DropDownList; dataMemberCombo.Sorted = true; dataMemberCombo.TabIndex = 4; dataMemberCombo.NotSetText = SR.GetString(SR.DGGen_DMNone); dataMemberCombo.SelectedIndexChanged += new EventHandler(this.OnSelChangedDataMember); dataKeyFieldLabel.SetBounds(12, 66, 170, 16); dataKeyFieldLabel.Text = SR.GetString(SR.DGGen_DataKey); dataKeyFieldLabel.TabStop = false; dataKeyFieldLabel.TabIndex = 5; dataKeyFieldCombo.SetBounds(12, 82, 140, 64); dataKeyFieldCombo.DropDownStyle = ComboBoxStyle.DropDownList; dataKeyFieldCombo.Sorted = true; dataKeyFieldCombo.TabIndex = 6; dataKeyFieldCombo.NotSetText = SR.GetString(SR.DGGen_DKNone); dataKeyFieldCombo.SelectedIndexChanged += new EventHandler(this.OnSelChangedDataKeyField); columnInfoLabel.SetBounds(8, 112, 420, 48); columnInfoLabel.TabStop = false; columnInfoLabel.TabIndex = 7; headerFooterGroup.SetBounds(4, 162, 431, 16); headerFooterGroup.Text = SR.GetString(SR.DGGen_HeaderFooterGroup); headerFooterGroup.TabIndex = 8; headerFooterGroup.TabStop = false; showHeaderCheck.SetBounds(12, 182, 160, 16); showHeaderCheck.TabIndex = 9; showHeaderCheck.Text = SR.GetString(SR.DGGen_ShowHeader); showHeaderCheck.TextAlign = ContentAlignment.MiddleLeft; showHeaderCheck.FlatStyle = FlatStyle.System; showHeaderCheck.CheckedChanged += new EventHandler(this.OnCheckChangedShowHeader); showFooterCheck.SetBounds(12, 202, 160, 16); showFooterCheck.TabIndex = 10; showFooterCheck.Text = SR.GetString(SR.DGGen_ShowFooter); showFooterCheck.TextAlign = ContentAlignment.MiddleLeft; showFooterCheck.FlatStyle = FlatStyle.System; showFooterCheck.CheckedChanged += new EventHandler(this.OnCheckChangedShowFooter); behaviorGroup.SetBounds(4, 228, 431, 16); behaviorGroup.Text = SR.GetString(SR.DGGen_BehaviorGroup); behaviorGroup.TabIndex = 11; behaviorGroup.TabStop = false; allowSortingCheck.SetBounds(12, 246, 160, 16); allowSortingCheck.Text = SR.GetString(SR.DGGen_AllowSorting); allowSortingCheck.TabIndex = 12; allowSortingCheck.TextAlign = ContentAlignment.MiddleLeft; allowSortingCheck.FlatStyle = FlatStyle.System; allowSortingCheck.CheckedChanged += new EventHandler(this.OnCheckChangedAllowSorting); this.Text = SR.GetString(SR.DGGen_Text); this.Size = new Size(464, 272); this.CommitOnDeactivate = true; this.Icon = new Icon(this.GetType(), "DataGridGeneralPage.ico"); Controls.Clear(); Controls.AddRange(new Control[] { allowSortingCheck, behaviorGroup, showFooterCheck, showHeaderCheck, headerFooterGroup, columnInfoLabel, dataKeyFieldCombo, dataKeyFieldLabel, dataMemberCombo, dataMemberLabel, dataSourceCombo, dataSourceLabel, dataGroup }); }
/// <include file='doc\DataListGeneralPage.uex' path='docs/doc[@for="DataListGeneralPage.InitForm"]/*' /> /// <devdoc> /// Initializes the UI of the form. /// </devdoc> private void InitForm() { GroupLabel dataGroup = new GroupLabel(); Label dataSourceLabel = new Label(); this.dataSourceCombo = new UnsettableComboBox(); Label dataMemberLabel = new Label(); this.dataMemberCombo = new UnsettableComboBox(); Label dataKeyFieldLabel = new Label(); this.dataKeyFieldCombo = new UnsettableComboBox(); GroupLabel headerFooterGroup = new GroupLabel(); this.showHeaderCheck = new CheckBox(); this.showFooterCheck = new CheckBox(); GroupLabel repeatGroup = new GroupLabel(); Label repeatColumnsLabel = new Label(); this.repeatColumnsEdit = new NumberEdit(); Label repeatDirectionLabel = new Label(); this.repeatDirectionCombo = new ComboBox(); Label repeatLayoutLabel = new Label(); this.repeatLayoutCombo = new ComboBox(); GroupLabel templatesGroup = new GroupLabel(); this.extractRowsCheck = new CheckBox(); dataGroup.SetBounds(4, 4, 360, 16); dataGroup.Text = SR.GetString(SR.DLGen_DataGroup); dataGroup.TabIndex = 0; dataGroup.TabStop = false; dataSourceLabel.SetBounds(8, 24, 170, 16); dataSourceLabel.Text = SR.GetString(SR.DLGen_DataSource); dataSourceLabel.TabStop = false; dataSourceLabel.TabIndex = 1; dataSourceCombo.SetBounds(8, 40, 140, 21); dataSourceCombo.DropDownStyle = ComboBoxStyle.DropDownList; dataSourceCombo.Sorted = true; dataSourceCombo.TabIndex = 2; dataSourceCombo.NotSetText = SR.GetString(SR.DLGen_DSUnbound); dataSourceCombo.SelectedIndexChanged += new EventHandler(this.OnSelChangedDataSource); dataMemberLabel.SetBounds(184, 24, 170, 16); dataMemberLabel.Text = SR.GetString(SR.DLGen_DataMember); dataMemberLabel.TabStop = false; dataMemberLabel.TabIndex = 3; dataMemberCombo.SetBounds(184, 40, 140, 21); dataMemberCombo.DropDownStyle = ComboBoxStyle.DropDownList; dataMemberCombo.Sorted = true; dataMemberCombo.TabIndex = 4; dataMemberCombo.NotSetText = SR.GetString(SR.DLGen_DMNone); dataMemberCombo.SelectedIndexChanged += new EventHandler(this.OnSelChangedDataMember); dataKeyFieldLabel.SetBounds(8, 66, 170, 16); dataKeyFieldLabel.Text = SR.GetString(SR.DLGen_DataKey); dataKeyFieldLabel.TabStop = false; dataKeyFieldLabel.TabIndex = 4; dataKeyFieldCombo.SetBounds(8, 82, 140, 21); dataKeyFieldCombo.DropDownStyle = ComboBoxStyle.DropDownList; dataKeyFieldCombo.Sorted = true; dataKeyFieldCombo.TabIndex = 5; dataKeyFieldCombo.NotSetText = SR.GetString(SR.DLGen_DKNone); dataKeyFieldCombo.SelectedIndexChanged += new EventHandler(this.OnSelChangedDataKeyField); headerFooterGroup.SetBounds(4, 108, 360, 16); headerFooterGroup.Text = SR.GetString(SR.DLGen_HeaderFooterGroup); headerFooterGroup.TabIndex = 6; headerFooterGroup.TabStop = false; showHeaderCheck.SetBounds(8, 128, 170, 16); showHeaderCheck.TabIndex = 7; showHeaderCheck.Text = SR.GetString(SR.DLGen_ShowHeader); showHeaderCheck.TextAlign = ContentAlignment.MiddleLeft; showHeaderCheck.FlatStyle = FlatStyle.System; showHeaderCheck.CheckedChanged += new EventHandler(this.OnCheckChangedShowHeader); showFooterCheck.SetBounds(8, 146, 170, 16); showFooterCheck.TabIndex = 8; showFooterCheck.Text = SR.GetString(SR.DLGen_ShowFooter); showFooterCheck.TextAlign = ContentAlignment.MiddleLeft; showFooterCheck.FlatStyle = FlatStyle.System; showFooterCheck.CheckedChanged += new EventHandler(this.OnCheckChangedShowFooter); repeatGroup.SetBounds(4, 172, 360, 16); repeatGroup.Text = SR.GetString(SR.DLGen_RepeatLayoutGroup); repeatGroup.TabIndex = 9; repeatGroup.TabStop = false; repeatColumnsLabel.SetBounds(8, 192, 106, 16); repeatColumnsLabel.Text = SR.GetString(SR.DLGen_RepeatColumns); repeatColumnsLabel.TabStop = false; repeatColumnsLabel.TabIndex = 10; repeatColumnsEdit.SetBounds(112, 188, 40, 21); repeatColumnsEdit.AllowDecimal = false; repeatColumnsEdit.AllowNegative = false; repeatColumnsEdit.TabIndex = 11; repeatColumnsEdit.TextChanged += new EventHandler(this.OnChangedRepeatProps); repeatDirectionLabel.SetBounds(8, 217, 106, 16); repeatDirectionLabel.Text = SR.GetString(SR.DLGen_RepeatDirection); repeatDirectionLabel.TabStop = false; repeatDirectionLabel.TabIndex = 12; repeatDirectionCombo.SetBounds(112, 213, 140, 56); repeatDirectionCombo.DropDownStyle = ComboBoxStyle.DropDownList; repeatDirectionCombo.Items.AddRange(new object[] { SR.GetString(SR.DLGen_RD_Horz), SR.GetString(SR.DLGen_RD_Vert) }); repeatDirectionCombo.TabIndex = 13; repeatDirectionCombo.SelectedIndexChanged += new EventHandler(this.OnChangedRepeatProps); repeatLayoutLabel.SetBounds(8, 242, 106, 16); repeatLayoutLabel.Text = SR.GetString(SR.DLGen_RepeatLayout); repeatLayoutLabel.TabStop = false; repeatLayoutLabel.TabIndex = 14; repeatLayoutCombo.SetBounds(112, 238, 140, 21); repeatLayoutCombo.DropDownStyle = ComboBoxStyle.DropDownList; repeatLayoutCombo.Items.AddRange(new object[] { SR.GetString(SR.DLGen_RL_Table), SR.GetString(SR.DLGen_RL_Flow) }); repeatLayoutCombo.TabIndex = 15; repeatLayoutCombo.SelectedIndexChanged += new EventHandler(this.OnChangedRepeatProps); templatesGroup.SetBounds(4, 266, 360, 16); templatesGroup.Text = "Templates"; templatesGroup.TabIndex = 16; templatesGroup.TabStop = false; templatesGroup.Visible = false; extractRowsCheck.SetBounds(8, 286, 260, 16); extractRowsCheck.Text = "Extract rows from Tables in template content"; extractRowsCheck.TabIndex = 17; extractRowsCheck.Visible = false; extractRowsCheck.FlatStyle = FlatStyle.System; extractRowsCheck.CheckedChanged += new EventHandler(this.OnCheckChangedExtractRows); this.Text = SR.GetString(SR.DLGen_Text); this.Size = new Size(368, 280); this.CommitOnDeactivate = true; this.Icon = new Icon(this.GetType(), "DataListGeneralPage.ico"); Controls.Clear(); Controls.AddRange(new Control[] { extractRowsCheck, templatesGroup, repeatLayoutCombo, repeatLayoutLabel, repeatDirectionCombo, repeatDirectionLabel, repeatColumnsEdit, repeatColumnsLabel, repeatGroup, showFooterCheck, showHeaderCheck, headerFooterGroup, dataKeyFieldCombo, dataKeyFieldLabel, dataMemberCombo, dataMemberLabel, dataSourceCombo, dataSourceLabel, dataGroup }); }
protected override void InitForm() { Debug.Assert(GetBaseControl() != null); _isBaseControlList = (GetBaseControl() is List); this._listDesigner = (IListDesigner)GetBaseDesigner(); Y = (_isBaseControlList ? 52 : 24); base.InitForm(); this.Text = SR.GetString(SR.ListItemsPage_Title); this.CommitOnDeactivate = true; this.Icon = new Icon( typeof(System.Web.UI.Design.MobileControls.MobileControlDesigner), "Items.ico" ); this.Size = new Size(382, 220); if (_isBaseControlList) { _itemsAsLinksCheckBox = new CheckBox(); _itemsAsLinksCheckBox.SetBounds(4, 4, 370, 16); _itemsAsLinksCheckBox.Text = SR.GetString(SR.ListItemsPage_ItemsAsLinksCaption); _itemsAsLinksCheckBox.FlatStyle = FlatStyle.System; _itemsAsLinksCheckBox.CheckedChanged += new EventHandler(this.OnSetPageDirty); _itemsAsLinksCheckBox.TabIndex = 0; } GroupLabel grplblItemList = new GroupLabel(); grplblItemList.SetBounds(4, _isBaseControlList ? 32 : 4, 372, LabelHeight); grplblItemList.Text = SR.GetString(SR.ListItemsPage_ItemListGroupLabel); grplblItemList.TabIndex = 1; grplblItemList.TabStop = false; TreeList.TabIndex = 2; Label lblValue = new Label(); lblValue.SetBounds(X, Y, 134, LabelHeight); lblValue.Text = SR.GetString(SR.ListItemsPage_ItemValueCaption); lblValue.TabStop = false; lblValue.TabIndex = Index; Y += LabelHeight; _txtValue = new TextBox(); _txtValue.SetBounds(X, Y, 134, CmbHeight); _txtValue.TextChanged += new EventHandler(this.OnPropertyChanged); _txtValue.TabIndex = Index + 1; this.Controls.AddRange(new Control[] { grplblItemList, lblValue, _txtValue }); if (_isBaseControlList) { this.Controls.Add(_itemsAsLinksCheckBox); } else { Y += CellSpace; _ckbSelected = new CheckBox(); _ckbSelected.SetBounds(X, Y, 134, LabelHeight); _ckbSelected.FlatStyle = System.Windows.Forms.FlatStyle.System; _ckbSelected.Text = SR.GetString(SR.ListItemsPage_ItemSelectedCaption); _ckbSelected.CheckedChanged += new EventHandler(this.OnPropertyChanged); _ckbSelected.TabIndex = Index + 2; this.Controls.Add(_ckbSelected); } }
protected override void InitForm() { base.InitForm(); this._objectList = (ObjectList)Component; this.CommitOnDeactivate = true; this.Icon = new Icon( typeof(System.Web.UI.Design.MobileControls.MobileControlDesigner), "Fields.ico" ); this.Size = new Size(402, 300); this.Text = SR.GetString(SR.ObjectListFieldsPage_Title); _ckbAutoGenerateFields = new CheckBox(); _cmbDataField = new UnsettableComboBox(); _ckbVisible = new CheckBox(); _txtDataFormatString = new TextBox(); _txtTitle = new TextBox(); _ckbAutoGenerateFields.SetBounds(4, 4, 396, LabelHeight); _ckbAutoGenerateFields.Text = SR.GetString(SR.ObjectListFieldsPage_AutoGenerateFieldsCaption); _ckbAutoGenerateFields.FlatStyle = FlatStyle.System; _ckbAutoGenerateFields.CheckedChanged += new EventHandler(this.OnSetPageDirty); _ckbAutoGenerateFields.TabIndex = 0; GroupLabel grplblFieldList = new GroupLabel(); grplblFieldList.SetBounds(4, 32, 392, LabelHeight); grplblFieldList.Text = SR.GetString(SR.ObjectListFieldsPage_FieldListGroupLabel); grplblFieldList.TabIndex = 1; grplblFieldList.TabStop = false; TreeList.TabIndex = 2; Label lblDataField = new Label(); lblDataField.SetBounds(X, Y, ControlWidth, LabelHeight); lblDataField.Text = SR.GetString(SR.ObjectListFieldsPage_DataFieldCaption); lblDataField.TabStop = false; lblDataField.TabIndex = Index; Y += LabelHeight; _cmbDataField.SetBounds(X, Y, ControlWidth, CmbHeight); _cmbDataField.DropDownStyle = ComboBoxStyle.DropDown; _cmbDataField.Sorted = true; _cmbDataField.NotSetText = SR.GetString(SR.ObjectListFieldsPage_NoneComboEntry); _cmbDataField.TextChanged += new EventHandler(this.OnPropertyChanged); _cmbDataField.SelectedIndexChanged += new EventHandler(this.OnPropertyChanged); _cmbDataField.TabIndex = Index + 1; Y += CellSpace; Label lblDataFormatString = new Label(); lblDataFormatString.SetBounds(X, Y, ControlWidth, LabelHeight); lblDataFormatString.Text = SR.GetString(SR.ObjectListFieldsPage_DataFormatStringCaption); lblDataFormatString.TabStop = false; lblDataFormatString.TabIndex = Index + 2; Y += LabelHeight; _txtDataFormatString.SetBounds(X, Y, ControlWidth, CmbHeight); _txtDataFormatString.TextChanged += new EventHandler(this.OnPropertyChanged); _txtDataFormatString.TabIndex = Index + 3; Y += CellSpace; Label lblTitle = new Label(); lblTitle.SetBounds(X, Y, ControlWidth, LabelHeight); lblTitle.Text = SR.GetString(SR.ObjectListFieldsPage_TitleCaption); lblTitle.TabStop = false; lblTitle.TabIndex = Index + 4; Y += LabelHeight; _txtTitle.SetBounds(X, Y, ControlWidth, CmbHeight); _txtTitle.TextChanged += new EventHandler(this.OnPropertyChanged); _txtTitle.TabIndex = Index + 5; Y += CellSpace; _ckbVisible.SetBounds(X, Y, ControlWidth, CmbHeight); _ckbVisible.FlatStyle = System.Windows.Forms.FlatStyle.System; _ckbVisible.Text = SR.GetString(SR.ObjectListFieldsPage_VisibleCaption); _ckbVisible.CheckedChanged += new EventHandler(this.OnPropertyChanged); _ckbVisible.TabIndex = Index + 6; this.Controls.AddRange(new Control[] { _ckbAutoGenerateFields, grplblFieldList, lblDataField, _cmbDataField, lblDataFormatString, _txtDataFormatString, lblTitle, _txtTitle, _ckbVisible }); }
/// <summary> /// показать выбранные кнопки инструментальной панели /// </summary> private void InitializeToolButtons(List<ChartToolButtonSettings> buttons, Control panel) { const int buttonMarging = 3; var buttonTop = toolBtnCross.Top; var firstUserButtonX = btnFlipPanelChartTools.Right + buttonMarging; var buttonSize = toolBtnCross.Size; // удалить кнопки while (panel.Controls.Count > 1) panel.Controls.RemoveAt(1); // добавить кнопки var left = firstUserButtonX; foreach (var btnDescr in buttons) { if (btnDescr.Group != null) continue; var button = new CheckBox { Parent = panel, ImageIndex = btnDescr.Image, Tag = btnDescr, Appearance = Appearance.Button, //FlatStyle = FlatStyle.Flat, ImageList = lstGlyph32, }; // кнопка "Курсор" нажата по-умолчанию if (btnDescr.ButtonType == ChartToolButtonSettings.ToolButtonType.Chart && btnDescr.Tool == CandleChartControl.ChartTool.Cursor) button.Checked = true; // кнопки "Запустить роботов", "Портфель роботов", "Состояние роботов" UpdateRobotIconUnsafe(robotFarm != null ? robotFarm.State : RobotFarm.RobotFarmState.Stopped); buttonToolTip.SetToolTip(button, btnDescr.ToString()); if (btnDescr.IsVisibleDisplayName) { button.Text = btnDescr.ToString(); var len = (int) button.CreateGraphics().MeasureString(button.Text, button.Font).Width + lstGlyph32.ImageSize.Width + 16; button.SetBounds(left, buttonTop, len, buttonSize.Height); left += (len + buttonMarging); button.ImageAlign = ContentAlignment.MiddleLeft; button.TextAlign = ContentAlignment.MiddleRight; } else { button.SetBounds(left, buttonTop, buttonSize.Width, buttonSize.Height); left += (buttonSize.Width + buttonMarging); } button.Click += ToolStripBtnClick; // добавить в панель panel.Controls.Add(button); } // добавить кнопки-менюшки var groupBtnWidth = buttonSize.Width + 12; var buttonGroups = buttons.Where(b => b.Group != null).Select(b => b.Group).Distinct().ToList(); foreach (var group in buttonGroups) { var groupBtn = new Button { Parent = panel, ImageIndex = group.ImageIndex, Tag = group, ImageList = lstGlyph32, FlatStyle = FlatStyle.Flat, Text = " ...", ImageAlign = ContentAlignment.MiddleLeft, TextAlign = ContentAlignment.MiddleRight }; buttonToolTip.SetToolTip(groupBtn, group.Title); groupBtn.SetBounds(left, buttonTop, groupBtnWidth, buttonSize.Height); left += (groupBtn.Width + buttonMarging); // создать менюшку groupBtn.Click += GroupBtnClick; var btnMenu = new ContextMenuStrip {/*Parent = this,*/ Tag = group.Title}; var thisGroup = group; var groupButtons = buttons.Where(b => b.Group == thisGroup); foreach (var btn in groupButtons) { var item = new ToolStripButton(btn.ToString(), lstGlyph32.Images[btn.Image], ToolStripBtnClick) {Tag = btn}; btnMenu.Items.Add(item); if (btnMenu.Width < item.Width) btnMenu.Width = item.Width; } // добавить пустышку, чтобы размер меню был посчитан корректно if (btnMenu.Items.Count == 1) { var item = new ToolStripLabel("empty") {Visible = false}; btnMenu.Items.Add(item); } buttonMenus.Add(btnMenu); } // назначить дефолтовый инструмент графикам foreach (var child in Charts) { child.chart.ActiveChartTool = CandleChartControl.ChartTool.Cursor; } // развернуть панель BtnFlipPanelChartToolsClick(panel.Controls[0], EventArgs.Empty); }
/// <include file='doc\DataGridPagingPage.uex' path='docs/doc[@for="DataGridPagingPage.InitForm"]/*' /> /// <devdoc> /// Creates the UI of the page. /// </devdoc> private void InitForm() { GroupLabel pagingGroup = new GroupLabel(); this.allowPagingCheck = new CheckBox(); this.allowCustomPagingCheck = new CheckBox(); Label pageSizeLabel = new Label(); this.pageSizeEdit = new NumberEdit(); Label miscLabel = new Label(); GroupLabel navigationGroup = new GroupLabel(); this.visibleCheck = new CheckBox(); Label pagingPosLabel = new Label(); this.posCombo = new ComboBox(); Label pagingModeLabel = new Label(); this.modeCombo = new ComboBox(); Label nextPageLabel = new Label(); this.nextPageTextEdit = new TextBox(); Label prevPageLabel = new Label(); this.prevPageTextEdit = new TextBox(); Label pageButtonCountLabel = new Label(); this.pageButtonCountEdit = new NumberEdit(); pagingGroup.SetBounds(4, 4, 431, 16); pagingGroup.Text = SR.GetString(SR.DGPg_PagingGroup); pagingGroup.TabStop = false; pagingGroup.TabIndex = 0; allowPagingCheck.SetBounds(12, 24, 180, 16); allowPagingCheck.Text = SR.GetString(SR.DGPg_AllowPaging); allowPagingCheck.TextAlign = ContentAlignment.MiddleLeft; allowPagingCheck.TabIndex = 1; allowPagingCheck.FlatStyle = FlatStyle.System; allowPagingCheck.CheckedChanged += new EventHandler(this.OnCheckChangedAllowPaging); allowCustomPagingCheck.SetBounds(220, 24, 180, 16); allowCustomPagingCheck.Text = SR.GetString(SR.DGPg_AllowCustomPaging); allowCustomPagingCheck.TextAlign = ContentAlignment.MiddleLeft; allowCustomPagingCheck.TabIndex = 2; allowCustomPagingCheck.FlatStyle = FlatStyle.System; allowCustomPagingCheck.CheckedChanged += new EventHandler(this.OnCheckChangedAllowCustomPaging); pageSizeLabel.SetBounds(12, 50, 100, 14); pageSizeLabel.Text = SR.GetString(SR.DGPg_PageSize); pageSizeLabel.TabStop = false; pageSizeLabel.TabIndex = 3; pageSizeEdit.SetBounds(112, 46, 40, 24); pageSizeEdit.TabIndex = 4; pageSizeEdit.AllowDecimal = false; pageSizeEdit.AllowNegative = false; pageSizeEdit.TextChanged += new EventHandler(this.OnTextChangedPageSize); miscLabel.SetBounds(158, 50, 80, 14); miscLabel.Text = SR.GetString(SR.DGPg_Rows); miscLabel.TabStop = false; miscLabel.TabIndex = 5; navigationGroup.SetBounds(4, 78, 431, 14); navigationGroup.Text = SR.GetString(SR.DGPg_NavigationGroup); navigationGroup.TabStop = false; navigationGroup.TabIndex = 6; visibleCheck.SetBounds(12, 100, 260, 16); visibleCheck.Text = SR.GetString(SR.DGPg_Visible); visibleCheck.TextAlign = ContentAlignment.MiddleLeft; visibleCheck.TabIndex = 7; visibleCheck.FlatStyle = FlatStyle.System; visibleCheck.CheckedChanged += new EventHandler(this.OnCheckChangedVisible); pagingPosLabel.SetBounds(12, 122, 150, 14); pagingPosLabel.Text = SR.GetString(SR.DGPg_Position); pagingPosLabel.TabStop = false; pagingPosLabel.TabIndex = 8; posCombo.SetBounds(12, 138, 144, 21); posCombo.TabIndex = 9; posCombo.DropDownStyle = ComboBoxStyle.DropDownList; posCombo.Items.AddRange(new object[] { SR.GetString(SR.DGPg_Pos_Top), SR.GetString(SR.DGPg_Pos_Bottom), SR.GetString(SR.DGPg_Pos_TopBottom) }); posCombo.SelectedIndexChanged += new EventHandler(this.OnPagerChanged); pagingModeLabel.SetBounds(12, 166, 150, 14); pagingModeLabel.Text = SR.GetString(SR.DGPg_Mode); pagingModeLabel.TabStop = false; pagingModeLabel.TabIndex = 10; modeCombo.SetBounds(12, 182, 144, 64); modeCombo.TabIndex = 11; modeCombo.DropDownStyle = ComboBoxStyle.DropDownList; modeCombo.Items.AddRange(new object[] { SR.GetString(SR.DGPg_Mode_Buttons), SR.GetString(SR.DGPg_Mode_Numbers) }); modeCombo.SelectedIndexChanged += new EventHandler(this.OnPagerChanged); nextPageLabel.SetBounds(12, 210, 200, 14); nextPageLabel.Text = SR.GetString(SR.DGPg_NextPage); nextPageLabel.TabStop = false; nextPageLabel.TabIndex = 12; nextPageTextEdit.SetBounds(12, 226, 144, 24); nextPageTextEdit.TabIndex = 13; nextPageTextEdit.TextChanged += new EventHandler(this.OnPagerChanged); prevPageLabel.SetBounds(220, 210, 200, 14); prevPageLabel.Text = SR.GetString(SR.DGPg_PrevPage); prevPageLabel.TabStop = false; prevPageLabel.TabIndex = 14; prevPageTextEdit.SetBounds(220, 226, 140, 24); prevPageTextEdit.TabIndex = 15; prevPageTextEdit.TextChanged += new EventHandler(this.OnPagerChanged); pageButtonCountLabel.SetBounds(12, 254, 200, 14); pageButtonCountLabel.Text = SR.GetString(SR.DGPg_ButtonCount); pageButtonCountLabel.TabStop = false; pageButtonCountLabel.TabIndex = 16; pageButtonCountEdit.SetBounds(12, 270, 40, 24); pageButtonCountEdit.TabIndex = 17; pageButtonCountEdit.AllowDecimal = false; pageButtonCountEdit.AllowNegative = false; pageButtonCountEdit.TextChanged += new EventHandler(this.OnPagerChanged); this.Text = SR.GetString(SR.DGPg_Text); this.Size = new Size(464, 300); this.CommitOnDeactivate = true; this.Icon = new Icon(this.GetType(), "DataGridPagingPage.ico"); this.Controls.Clear(); this.Controls.AddRange(new Control[] { pageButtonCountEdit, pageButtonCountLabel, prevPageTextEdit, prevPageLabel, nextPageTextEdit, nextPageLabel, modeCombo, pagingModeLabel, posCombo, pagingPosLabel, visibleCheck, navigationGroup, miscLabel, pageSizeEdit, pageSizeLabel, allowCustomPagingCheck, allowPagingCheck, pagingGroup }); }