private void FormatStringDialog_Load(object sender, EventArgs e) { string str = (this.dgvCellStyle != null) ? this.dgvCellStyle.Format : this.listControl.FormatString; object obj2 = (this.dgvCellStyle != null) ? this.dgvCellStyle.NullValue : null; string str2 = string.Empty; if (!string.IsNullOrEmpty(str)) { str2 = FormatControl.FormatTypeStringFromFormatString(str); } if (this.dgvCellStyle != null) { this.formatControl1.NullValueTextBoxEnabled = true; } else { this.formatControl1.NullValueTextBoxEnabled = false; } this.formatControl1.FormatType = str2; FormatControl.FormatTypeClass formatTypeItem = this.formatControl1.FormatTypeItem; if (formatTypeItem != null) { formatTypeItem.PushFormatStringIntoFormatType(str); } else { this.formatControl1.FormatType = System.Design.SR.GetString("BindingFormattingDialogFormatTypeNoFormatting"); } this.formatControl1.NullValue = (obj2 != null) ? obj2.ToString() : ""; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { _cancelButton = new Button(); _okButton = new Button(); _formatControl1 = new FormatControl(); SuspendLayout(); // // formatControl1 // _formatControl1.Location = new Drawing.Point(10, 10); _formatControl1.Margin = new Padding(0); _formatControl1.Name = "formatControl1"; _formatControl1.Size = new Drawing.Size(376, 268); _formatControl1.TabIndex = 0; // // cancelButton // _cancelButton.Location = new Drawing.Point(299, 288); _cancelButton.Name = "cancelButton"; _cancelButton.Size = new Drawing.Size(87, 23); _cancelButton.TabIndex = 2; _cancelButton.Text = SR.DataGridView_Cancel; _cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; _cancelButton.Click += new EventHandler(cancelButton_Click); // // okButton // _okButton.Location = new Drawing.Point(203, 288); _okButton.Name = "okButton"; _okButton.Size = new Drawing.Size(87, 23); _okButton.TabIndex = 1; _okButton.Text = SR.DataGridView_OK; _okButton.DialogResult = System.Windows.Forms.DialogResult.OK; _okButton.Click += new EventHandler(okButton_Click); // // Form1 // AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; AutoScaleDimensions = new Drawing.SizeF(6, 13); ClientSize = new Drawing.Size(396, 295); AutoSize = true; HelpButton = true; MaximizeBox = false; MinimizeBox = false; FormBorderStyle = FormBorderStyle.FixedDialog; StartPosition = FormStartPosition.CenterScreen; ShowInTaskbar = false; Icon = null; Name = "Form1"; Controls.Add(_okButton); Controls.Add(_formatControl1); Controls.Add(_cancelButton); Padding = new Padding(0); Text = SR.FormatStringDialogTitle; HelpButtonClicked += new CancelEventHandler(FormatStringDialog_HelpButtonClicked); HelpRequested += new HelpEventHandler(FormatStringDialog_HelpRequested); Load += new EventHandler(FormatStringDialog_Load); ResumeLayout(false); }
private void InitializeComponent() { this.cancelButton = new Button(); this.okButton = new Button(); this.formatControl1 = new FormatControl(); base.SuspendLayout(); this.formatControl1.Location = new Point(10, 10); this.formatControl1.Margin = new Padding(0); this.formatControl1.Name = "formatControl1"; this.formatControl1.Size = new Size(0x178, 0x10c); this.formatControl1.TabIndex = 0; this.cancelButton.Location = new Point(0x12b, 0x120); this.cancelButton.Name = "cancelButton"; this.cancelButton.Size = new Size(0x57, 0x17); this.cancelButton.TabIndex = 2; this.cancelButton.Text = System.Design.SR.GetString("DataGridView_Cancel"); this.cancelButton.DialogResult = DialogResult.Cancel; this.cancelButton.Click += new EventHandler(this.cancelButton_Click); this.okButton.Location = new Point(0xcb, 0x120); this.okButton.Name = "okButton"; this.okButton.Size = new Size(0x57, 0x17); this.okButton.TabIndex = 1; this.okButton.Text = System.Design.SR.GetString("DataGridView_OK"); this.okButton.DialogResult = DialogResult.OK; this.okButton.Click += new EventHandler(this.okButton_Click); base.AutoScaleMode = AutoScaleMode.Font; base.AutoScaleDimensions = new SizeF(6f, 13f); base.ClientSize = new Size(0x18c, 0x127); this.AutoSize = true; base.HelpButton = true; base.MaximizeBox = false; base.MinimizeBox = false; base.FormBorderStyle = FormBorderStyle.FixedDialog; base.StartPosition = FormStartPosition.CenterScreen; base.ShowInTaskbar = false; base.Icon = null; base.Name = "Form1"; base.Controls.Add(this.okButton); base.Controls.Add(this.formatControl1); base.Controls.Add(this.cancelButton); base.Padding = new Padding(0); this.Text = System.Design.SR.GetString("FormatStringDialogTitle"); base.HelpButtonClicked += new CancelEventHandler(this.FormatStringDialog_HelpButtonClicked); base.HelpRequested += new HelpEventHandler(this.FormatStringDialog_HelpRequested); base.Load += new EventHandler(this.FormatStringDialog_Load); base.ResumeLayout(false); }
private void FormatStringDialog_Load(object sender, EventArgs e) { // make a reasonable guess what user control should be shown string formatString = _dgvCellStyle != null ? _dgvCellStyle.Format : _listControl.FormatString; object nullValue = _dgvCellStyle != null ? _dgvCellStyle.NullValue : null; string formatType = string.Empty; if (!string.IsNullOrEmpty(formatString)) { formatType = FormatControl.FormatTypeStringFromFormatString(formatString); } // the null value text box should be enabled only when editing DataGridViewCellStyle // when we are editing ListControl, it should be disabled if (_dgvCellStyle != null) { _formatControl1.NullValueTextBoxEnabled = true; } else { Debug.Assert(_listControl != null, "we check this everywhere, but it does not hurt to check it again"); _formatControl1.NullValueTextBoxEnabled = false; } _formatControl1.FormatType = formatType; // push the information from FormatString/FormatInfo/NullValue into the FormattingUserControl FormatControl.FormatTypeClass formatTypeItem = _formatControl1.FormatTypeItem; if (formatTypeItem != null) { // parsing the FormatString uses the CultureInfo. So push the CultureInfo before push the FormatString. formatTypeItem.PushFormatStringIntoFormatType(formatString); } else { // make General format type the default _formatControl1.FormatType = SR.BindingFormattingDialogFormatTypeNoFormatting; } _formatControl1.NullValue = nullValue != null?nullValue.ToString() : ""; }
public DateTimeFormatType(FormatControl owner) { _owner = owner; }
public CurrencyFormatType(FormatControl owner) { this._owner = owner; }
public NumericFormatType(FormatControl owner) { _owner = owner; }
public CustomFormatType(FormatControl owner) { _owner = owner; }
public ScientificFormatType(FormatControl owner) { _owner = owner; }
public DateTimeFormatType(FormatControl owner) { this.owner = owner; }
public CurrencyFormatType(FormatControl owner) { this.owner = owner; }
public ScientificFormatType(FormatControl owner) { this.owner = owner; }
public NumericFormatType(FormatControl owner) { this.owner = owner; }
private void BindingFormattingDialog_Load(object sender, EventArgs e) { this.inLoad = true; try { BindingTreeNode node6; this.dirty = false; Font defaultFont = Control.DefaultFont; IUIService service = null; if (this.bindings.BindableComponent.Site != null) { service = (IUIService)this.bindings.BindableComponent.Site.GetService(typeof(IUIService)); } if (service != null) { defaultFont = (Font)service.Styles["DialogFont"]; } this.Font = defaultFont; DesignerUtils.ApplyTreeViewThemeStyles(this.propertiesTreeView); if (this.propertiesTreeView.ImageList == null) { ImageList list = new ImageList(); list.Images.Add(BoundBitmap); list.Images.Add(UnboundBitmap); this.propertiesTreeView.ImageList = list; } BindingTreeNode node = null; BindingTreeNode node2 = null; string name = null; string str2 = null; foreach (Attribute attribute in TypeDescriptor.GetAttributes(this.bindings.BindableComponent)) { if (attribute is DefaultBindingPropertyAttribute) { name = ((DefaultBindingPropertyAttribute)attribute).Name; break; } if (attribute is DefaultPropertyAttribute) { str2 = ((DefaultPropertyAttribute)attribute).Name; } } this.propertiesTreeView.Nodes.Clear(); TreeNode node3 = new TreeNode(System.Design.SR.GetString("BindingFormattingDialogCommonTreeNode")); TreeNode node4 = new TreeNode(System.Design.SR.GetString("BindingFormattingDialogAllTreeNode")); this.propertiesTreeView.Nodes.Add(node3); this.propertiesTreeView.Nodes.Add(node4); PropertyDescriptorCollection properties = TypeDescriptor.GetProperties(this.bindings.BindableComponent); for (int i = 0; i < properties.Count; i++) { if (!properties[i].IsReadOnly) { BindableAttribute attribute2 = (BindableAttribute)properties[i].Attributes[typeof(BindableAttribute)]; BrowsableAttribute attribute3 = (BrowsableAttribute)properties[i].Attributes[typeof(BrowsableAttribute)]; if (((attribute3 == null) || attribute3.Browsable) || ((attribute2 != null) && attribute2.Bindable)) { BindingTreeNode node5 = new BindingTreeNode(properties[i].Name) { Binding = this.FindBinding(properties[i].Name) }; if (node5.Binding != null) { node5.FormatType = FormatControl.FormatTypeStringFromFormatString(node5.Binding.FormatString); } else { node5.FormatType = System.Design.SR.GetString("BindingFormattingDialogFormatTypeNoFormatting"); } if ((attribute2 != null) && attribute2.Bindable) { node3.Nodes.Add(node5); } else { node4.Nodes.Add(node5); } if (((node == null) && !string.IsNullOrEmpty(name)) && (string.Compare(properties[i].Name, name, false, CultureInfo.CurrentCulture) == 0)) { node = node5; } else if (((node2 == null) && !string.IsNullOrEmpty(str2)) && (string.Compare(properties[i].Name, str2, false, CultureInfo.CurrentCulture) == 0)) { node2 = node5; } } } } node3.Expand(); node4.Expand(); this.propertiesTreeView.Sort(); if (node != null) { node6 = node; } else if (node2 != null) { node6 = node2; } else if (node3.Nodes.Count > 0) { node6 = FirstNodeInAlphabeticalOrder(node3.Nodes) as BindingTreeNode; } else if (node4.Nodes.Count > 0) { node6 = FirstNodeInAlphabeticalOrder(node4.Nodes) as BindingTreeNode; } else { node6 = null; } this.propertiesTreeView.SelectedNode = node6; if (node6 != null) { node6.EnsureVisible(); } this.dataSourcePicker.PropertyName = node6.Text; this.dataSourcePicker.Binding = (node6 != null) ? node6.Binding : null; this.dataSourcePicker.Enabled = true; this.dataSourcePicker.OwnerComponent = this.bindings.BindableComponent; this.dataSourcePicker.DefaultDataSourceUpdateMode = this.bindings.DefaultDataSourceUpdateMode; if ((node6 != null) && (node6.Binding != null)) { this.bindingUpdateDropDown.Enabled = true; this.bindingUpdateDropDown.SelectedItem = node6.Binding.DataSourceUpdateMode; this.updateModeLabel.Enabled = true; this.formatControl1.Enabled = true; this.formatControl1.FormatType = node6.FormatType; this.formatControl1.FormatTypeItem.PushFormatStringIntoFormatType(node6.Binding.FormatString); if (node6.Binding.NullValue != null) { this.formatControl1.NullValue = node6.Binding.NullValue.ToString(); } else { this.formatControl1.NullValue = string.Empty; } } else { this.bindingUpdateDropDown.Enabled = false; this.bindingUpdateDropDown.SelectedItem = this.bindings.DefaultDataSourceUpdateMode; this.updateModeLabel.Enabled = false; this.formatControl1.Enabled = false; this.formatControl1.FormatType = string.Empty; } this.formatControl1.Dirty = false; this.currentBindingTreeNode = this.propertiesTreeView.SelectedNode as BindingTreeNode; } finally { this.inLoad = false; } }
private void InitializeComponent() { ComponentResourceManager manager = new ComponentResourceManager(typeof(BindingFormattingDialog)); this.explanationLabel = new Label(); this.mainTableLayoutPanel = new TableLayoutPanel(); this.propertiesTreeView = new TreeView(); this.propertyLabel = new Label(); this.dataSourcePicker = new BindingFormattingWindowsFormsEditorService(); this.bindingLabel = new Label(); this.updateModeLabel = new Label(); this.bindingUpdateDropDown = new ComboBox(); this.formatControl1 = new FormatControl(); this.okCancelTableLayoutPanel = new TableLayoutPanel(); this.okButton = new Button(); this.cancelButton = new Button(); this.mainTableLayoutPanel.SuspendLayout(); this.okCancelTableLayoutPanel.SuspendLayout(); base.ShowIcon = false; base.SuspendLayout(); manager.ApplyResources(this.explanationLabel, "explanationLabel"); this.mainTableLayoutPanel.SetColumnSpan(this.explanationLabel, 3); this.explanationLabel.Name = "explanationLabel"; manager.ApplyResources(this.mainTableLayoutPanel, "mainTableLayoutPanel"); this.mainTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100f)); this.mainTableLayoutPanel.ColumnStyles.Add(new ColumnStyle()); this.mainTableLayoutPanel.ColumnStyles.Add(new ColumnStyle()); this.mainTableLayoutPanel.Controls.Add(this.okCancelTableLayoutPanel, 2, 4); this.mainTableLayoutPanel.Controls.Add(this.formatControl1, 1, 3); this.mainTableLayoutPanel.Controls.Add(this.bindingUpdateDropDown, 2, 2); this.mainTableLayoutPanel.Controls.Add(this.propertiesTreeView, 0, 2); this.mainTableLayoutPanel.Controls.Add(this.updateModeLabel, 2, 1); this.mainTableLayoutPanel.Controls.Add(this.dataSourcePicker, 1, 2); this.mainTableLayoutPanel.Controls.Add(this.explanationLabel, 0, 0); this.mainTableLayoutPanel.Controls.Add(this.bindingLabel, 1, 1); this.mainTableLayoutPanel.Controls.Add(this.propertyLabel, 0, 1); this.mainTableLayoutPanel.MinimumSize = new Size(0x21e, 0x11b); this.mainTableLayoutPanel.Name = "mainTableLayoutPanel"; this.mainTableLayoutPanel.RowStyles.Add(new RowStyle()); this.mainTableLayoutPanel.RowStyles.Add(new RowStyle()); this.mainTableLayoutPanel.RowStyles.Add(new RowStyle()); this.mainTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Percent, 100f)); this.mainTableLayoutPanel.RowStyles.Add(new RowStyle()); manager.ApplyResources(this.propertiesTreeView, "propertiesTreeView"); this.propertiesTreeView.Name = "propertiesTreeView"; this.propertiesTreeView.HideSelection = false; this.propertiesTreeView.TreeViewNodeSorter = new TreeNodeComparer(); this.mainTableLayoutPanel.SetRowSpan(this.propertiesTreeView, 2); this.propertiesTreeView.BeforeSelect += new TreeViewCancelEventHandler(this.propertiesTreeView_BeforeSelect); this.propertiesTreeView.AfterSelect += new TreeViewEventHandler(this.propertiesTreeView_AfterSelect); manager.ApplyResources(this.propertyLabel, "propertyLabel"); this.propertyLabel.Name = "propertyLabel"; manager.ApplyResources(this.dataSourcePicker, "dataSourcePicker"); this.dataSourcePicker.Name = "dataSourcePicker"; this.dataSourcePicker.PropertyValueChanged += new EventHandler(this.dataSourcePicker_PropertyValueChanged); manager.ApplyResources(this.bindingLabel, "bindingLabel"); this.bindingLabel.Name = "bindingLabel"; manager.ApplyResources(this.updateModeLabel, "updateModeLabel"); this.updateModeLabel.Name = "updateModeLabel"; this.bindingUpdateDropDown.FormattingEnabled = true; manager.ApplyResources(this.bindingUpdateDropDown, "bindingUpdateDropDown"); this.bindingUpdateDropDown.DropDownStyle = ComboBoxStyle.DropDownList; this.bindingUpdateDropDown.Name = "bindingUpdateDropDown"; this.bindingUpdateDropDown.Items.AddRange(new object[] { DataSourceUpdateMode.Never, DataSourceUpdateMode.OnPropertyChanged, DataSourceUpdateMode.OnValidation }); this.bindingUpdateDropDown.SelectedIndexChanged += new EventHandler(this.bindingUpdateDropDown_SelectedIndexChanged); this.mainTableLayoutPanel.SetColumnSpan(this.formatControl1, 2); manager.ApplyResources(this.formatControl1, "formatControl1"); this.formatControl1.MinimumSize = new Size(390, 0xed); this.formatControl1.Name = "formatControl1"; this.formatControl1.NullValueTextBoxEnabled = true; manager.ApplyResources(this.okCancelTableLayoutPanel, "okCancelTableLayoutPanel"); this.okCancelTableLayoutPanel.AutoSizeMode = AutoSizeMode.GrowAndShrink; this.okCancelTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f)); this.okCancelTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50f)); this.okCancelTableLayoutPanel.Controls.Add(this.cancelButton, 1, 0); this.okCancelTableLayoutPanel.Controls.Add(this.okButton, 0, 0); this.okCancelTableLayoutPanel.Name = "okCancelTableLayoutPanel"; this.okCancelTableLayoutPanel.RowStyles.Add(new RowStyle(SizeType.Absolute, 29f)); manager.ApplyResources(this.okButton, "okButton"); this.okButton.Name = "okButton"; this.okButton.DialogResult = DialogResult.OK; this.okButton.Click += new EventHandler(this.okButton_Click); manager.ApplyResources(this.cancelButton, "cancelButton"); this.cancelButton.Name = "cancelButton"; this.cancelButton.DialogResult = DialogResult.Cancel; this.cancelButton.Click += new EventHandler(this.cancelButton_Click); manager.ApplyResources(this, "$this"); base.AutoScaleMode = AutoScaleMode.Font; base.StartPosition = FormStartPosition.CenterParent; base.CancelButton = this.cancelButton; base.AcceptButton = this.okButton; base.Controls.Add(this.mainTableLayoutPanel); base.FormBorderStyle = FormBorderStyle.Sizable; base.Name = "BindingFormattingDialog"; this.mainTableLayoutPanel.ResumeLayout(false); this.mainTableLayoutPanel.PerformLayout(); this.okCancelTableLayoutPanel.ResumeLayout(false); base.HelpButton = true; base.ShowInTaskbar = false; base.MinimizeBox = false; base.MaximizeBox = false; base.Load += new EventHandler(this.BindingFormattingDialog_Load); base.Closing += new CancelEventHandler(this.BindingFormattingDialog_Closing); base.HelpButtonClicked += new CancelEventHandler(this.BindingFormattingDialog_HelpButtonClicked); base.HelpRequested += new HelpEventHandler(this.BindingFormattingDialog_HelpRequested); base.ResumeLayout(false); base.PerformLayout(); }
public CustomFormatType(FormatControl owner) { this.owner = owner; }