void gridView2_ShowFilterPopupListBox(object sender, FilterPopupListBoxEventArgs e) { if (e.Column.FieldName == "DefaultValue") { Dictionary <string, List <object> > values = new Dictionary <string, List <object> >(); DevExpress.XtraEditors.Controls.ComboBoxItemCollection col = new DevExpress.XtraEditors.Controls.ComboBoxItemCollection(new DevExpress.XtraEditors.Repository.RepositoryItemComboBox()); foreach (FilterItem it in e.ComboBox.Items) { if (!it.Text.StartsWith("(")) { string t = it.Text; if (t.StartsWith("Value")) { t = NumericEditor.GetDisplayText(t, true, Plugin); } if (!values.ContainsKey(t)) { values.Add(t, new List <object>()); } values[t].Add("[DefaultValue] = '" + it.Value + "'"); } } foreach (string t in values.Keys) { DevExpress.XtraGrid.Columns.ColumnFilterInfo cfi = new DevExpress.XtraGrid.Columns.ColumnFilterInfo(String.Join(" OR ", values[t]), t); col.Add(new FilterItem(t, cfi)); } e.ComboBox.Items.Clear(); e.ComboBox.Items.Add(new FilterItem("(All)", new DevExpress.XtraGrid.Columns.ColumnFilterInfo())); e.ComboBox.Items.AddRange(col); } }
public void SetEditor(EditorType type) { ControlPanel.Controls.Clear(); Control editor = null; switch (type) { case EditorType.Int: editor = new NumericEditor(); ((NumericUpDown)editor.Controls[0]).DecimalPlaces = 0; break; case EditorType.Decimal: editor = new NumericEditor(); ((NumericUpDown)editor.Controls[0]).DecimalPlaces = 2; break; case EditorType.Date: editor = new DateValueEditor(); break; case EditorType.Text: default: editor = new TextValueEditor(); break; } editor.Dock = DockStyle.Fill; ControlPanel.Controls.Add(editor /*new TextValueEditor() { Dock = DockStyle.Fill }*/); this.ResumeLayout(); }
// =====================[ Construction ]========================== public TextEditNumberViewModel(NumericEditor owner, object value) { m_owner = owner; if (value == null) { value = 0.0f; } this.ValueType = value.GetType(); this.SetSourceValueOneWay(value); this.SetTextOneWay(); }
void IInitializable.Initialize() { var snapAngleEditor = new NumericEditor(typeof(float)); snapAngleEditor.ScaleFactor = 180.0 / Math.PI; string misc = "Misc".Localize(); var userSettings = new System.ComponentModel.PropertyDescriptor[] { new BoundPropertyDescriptor( m_designView, () => m_designView.BackColor, "BackgroundColor".Localize(), misc, "Background color".Localize()), new BoundPropertyDescriptor( m_designView, () => m_designView.CameraFarZ, "FarZ".Localize(), misc, "Camera Far Z".Localize()), new BoundPropertyDescriptor( m_designView, () => m_designView.ControlScheme, "ControlScheme".Localize(), misc, "Control scheme".Localize()), new BoundPropertyDescriptor( m_designView, () => m_designView.SnapVertex, "SnapVertex".Localize(), misc, "Snap vertex".Localize()), new BoundPropertyDescriptor( m_designView, () => m_designView.RotateOnSnap, "RotateOnSnap".Localize(), misc, "Rotate on snap".Localize()), new BoundPropertyDescriptor( m_designView, () => m_designView.SnapAngle, "Snap Angle".Localize(), misc, "Snap to angle when using rotation manipulator." + "Angle is in degrees. Set it to zero to disable snapping.".Localize(), snapAngleEditor, null) }; m_settingsService.RegisterUserSettings("Editors".Localize() + "/" + "DesignView".Localize(), userSettings); m_settingsService.RegisterSettings(this, userSettings); var snapfrom = new BoundPropertyDescriptor( m_designView, () => m_designView.SnapFrom, "SnapMode".Localize(), null, null); m_settingsService.RegisterSettings(this, snapfrom); if (m_scriptingService != null) { m_scriptingService.SetVariable("designView", m_designView); } }
public IntegerEditor(string valueFormat = null, int defaultValue = 0) : base(typeof(int), valueFormat, defaultValue) { _editControl = CreateEdit <NumericEditor>(); _editControl.IsRealNumber = false; }
public GraphNode(IFilter filter) { InitializeComponent(); _filter = filter; _filter.OnPinsChanged += OnPinsChanged; _filter.OnProcessingProgressChanged += OnProcessingProgressChanged; _filter.OnProcessingStateChanged += OnProcessingStateChanged; UpdateSize(_filter); var table = new TableLayoutPanel { Size = new Size(Width - 2, _filter.Properties.Count * PropertyHeight), Location = new Point(1, HeaderHeight + 2) }; table.ColumnStyles.Add(new ColumnStyle(SizeType.AutoSize)); table.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100)); for (int i = 0; i < _filter.Properties.Count; i++) { IFilterProperty property = _filter.Properties.Skip(i).First().Value; BasePropertyEditor editor; switch (property.Type) { case FilterPropertyType.String: editor = new PathEditor { Value = property.Value }; break; case FilterPropertyType.Float: case FilterPropertyType.Integer: editor = new NumericEditor((INumericProperty)property) { Value = Convert.ToDecimal(property.Value) }; break; case FilterPropertyType.Size: case FilterPropertyType.Point: editor = new PointEditor((IPointProperty)property) { Value = property.Value }; break; case FilterPropertyType.Enum: editor = new EnumEditor((IEnumProperty)property) { Value = property.Value }; break; default: throw new ArgumentOutOfRangeException(); } editor.Dock = DockStyle.Fill; editor.Margin = new Padding(0); editor.OnValueChanged += newValue => { property.Value = newValue; }; table.RowStyles.Add(new RowStyle(SizeType.AutoSize)); table.SetRow(editor, i); table.SetColumn(editor, 1); var label = new Label { Text = property.Name, Margin = new Padding(0), Dock = DockStyle.Right, AutoSize = true, Anchor = AnchorStyles.Right }; table.SetRow(label, i); table.SetColumn(label, 0); table.Controls.Add(label); table.Controls.Add(editor); } Controls.Add(table); }
private void InitializeVisibleFieldsList() { this.gridVisibleFields.Dock = DockStyle.Fill; this.gridVisibleFields.BorderStyle = BorderStyle.FixedSingle; this.gridVisibleFields.GridLineColor = Color.Transparent; this.gridVisibleFields.SelectionMode = SelectionMode.One; this.gridVisibleFields.RowSelectorPane.Visible = false; this.gridVisibleFields.AllowCellNavigation = false; this.gridVisibleFields.ScrollBars = GridScrollBars.Vertical; this.gridVisibleFields.FixedColumnSplitter.Visible = false; // // Configure column manager row // ColumnManagerRow columnManagerRow = new ColumnManagerRow(); this.gridVisibleFields.FixedHeaderRows.Add(columnManagerRow); columnManagerRow.AllowColumnReorder = false; columnManagerRow.AllowColumnResize = false; columnManagerRow.AllowSort = false; // // Configure columns // // "Visible" column DataBoundColumn visibleColumn = new DataBoundColumn("Visible"); this.gridVisibleFields.Columns.Add(visibleColumn); visibleColumn.Title = ""; visibleColumn.Width = 24; this.gridVisibleFields.DataRowTemplate.Cells[visibleColumn.Index].Click += new EventHandler(this.gridVisibleFields_Visible_Click); this.gridVisibleFields.DataRowTemplate.Cells[visibleColumn.Index].CanBeCurrent = false; // "Title" column DataBoundColumn titleColumn = new DataBoundColumn("Title"); this.gridVisibleFields.Columns.Add(titleColumn); titleColumn.Title = "Name"; this.gridVisibleFields.DataRowTemplate.Cells[titleColumn.Index].CanBeCurrent = false; // "Width" column DataBoundColumn widthColumn = new DataBoundColumn("Width"); this.gridVisibleFields.Columns.Add(widthColumn); NumericEditor numEditor = new NumericEditor(); numEditor.TemplateControl.Controls.Remove(numEditor.TemplateControl.DropDownButton); widthColumn.CellEditorManager = numEditor; this.InitializeWidthColumnUnit(); Cell widthCellTemplate = this.gridVisibleFields.DataRowTemplate.Cells["Width"]; widthCellTemplate.Click += new EventHandler(this.gridVisibleFields_Width_Click); // "EditWidth" column Column editWidthColumn = new Column("EditWidth", typeof(Image)); this.gridVisibleFields.Columns.Add(editWidthColumn); // Change to Chinese this.gridVisibleFields.Columns["Title"].Title = "����"; this.gridVisibleFields.Columns["Width"].Title = "���"; this.gridVisibleFields.Columns["EditWidth"].Title = "�༭���"; editWidthColumn.Title = ""; editWidthColumn.Width = 24; Cell editWidthCellTemplate = this.gridVisibleFields.DataRowTemplate.Cells["EditWidth"]; editWidthCellTemplate.Click += new EventHandler(this.gridVisibleFields_EditWidth_Click); editWidthCellTemplate.MouseEnter += new EventHandler(this.HandCursor_MouseEnter); editWidthCellTemplate.MouseLeave += new EventHandler(this.HandCursor_MouseLeave); editWidthCellTemplate.CanBeCurrent = false; // // Configure Data // this.gridVisibleFields.DataRowTemplate.Cells[visibleColumn.Index].ValueChanged += new EventHandler(gridVisibleFields_ValueChanged); this.gridVisibleFields.DataRowTemplate.Cells[widthColumn.Index].ValueChanged += new EventHandler(gridVisibleFields_ValueChanged); this.gridVisibleFields.DataRowTemplate.KeyDown += new KeyEventHandler(this.gridVisibleFields_DataRow_KeyDown); this.gridVisibleFields.DataRowTemplate.KeyPress += new KeyPressEventHandler(gridVisibleFields_DataRow_KeyPress); this.gridVisibleFields.DataRowTemplate.Cells[widthColumn.Index].EditLeft += new EditLeftEventHandler(this.gridVisibleFields_Width_EditLeft); this.gridVisibleFields.DataRowTemplate.EditEnded += new EventHandler(this.gridVisibleFields_DataRow_EditEnded); this.gridVisibleFields.DataRowTemplate.EditCanceled += new EventHandler(this.gridVisibleFields_DataRow_EditCanceled); this.gridVisibleFields.AddingDataRow += new AddingDataRowEventHandler(this.gridVisibleFields_AddingDataRow); this.gridVisibleFields.DataSource = ColumnProxy.FromGrid(m_gridLiveData, out m_hasDetailGridColumns); this.gridVisibleFields.SizeChanged += new EventHandler(gridVisibleFields_SizeChanged); this.panelColumnList.Controls.Add(this.gridVisibleFields); }
public FloatEditor(string valueFormat = null, double defaultValue = 0) : base(typeof(double), valueFormat, defaultValue) { _editControl = CreateEdit <NumericEditor>(); _editControl.IsRealNumber = true; }