public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value) { // Return the value if the value is not of type Int32, Double and Single. if (!(value is CalculateColumnInfo)) { return(value); } // Uses the IWindowsFormsEditorService to display a // drop-down UI in the Properties window. IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); if (edSvc != null) { CalculateColumnInfo calcuateColumnInfo = value as CalculateColumnInfo; // Display an angle selection control and retrieve the value. CalculateColumnEditorForm editForm = new CalculateColumnEditorForm(calcuateColumnInfo); if (DialogResult.OK == edSvc.ShowDialog(editForm)) { // Return the value in the appropraite data format. return(editForm.Value); } } return(value); }
public CalculateColumnEditorForm(CalculateColumnInfo calcuateColumnInfo) { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // //Create table style DataGridTableStyle style = new DataGridTableStyle(); style.PreferredRowHeight = 22; style.MappingName = strTableName; this.C_DataGrid.TableStyles.Add(style); // this.Value = calcuateColumnInfo.Copy(); this.chkDisplayClearSteps.Checked = this.value.DisplayedCalculteStep; this.CreateConditionTable(); }
private void BtnAddCombinedGridColumn_Click(object sender, EventArgs e) { CalculateColumnInfo calcColumnInfo = new CalculateColumnInfo(); Editors.CalculateColumnEditorForm calcEditorForm = new Webb.Reports.ExControls.Editors.CalculateColumnEditorForm(calcColumnInfo); if (calcEditorForm.ShowDialog() == DialogResult.OK) { calcColumnInfo = calcEditorForm.Value; } CombinedGridColumn combinedGridColumn = new CombinedGridColumn(); combinedGridColumn.CalculatingFormula = calcColumnInfo; this.C_LBSelFields.Items.Add(combinedGridColumn); }
private void BtnEditCalcInfo_Click(object sender, EventArgs e) { CalculateColumnInfo calculateColumnInfo = objField as CalculateColumnInfo; if (calculateColumnInfo == null) { calculateColumnInfo = new CalculateColumnInfo(); } CalculateColumnEditorForm calculateColumnInfoEditForm = new CalculateColumnEditorForm(calculateColumnInfo); if (calculateColumnInfoEditForm.ShowDialog() == DialogResult.OK) { calculateColumnInfoEditForm.HidechkDisplayedSteps(); objField = calculateColumnInfoEditForm.Value; this.SetDisplayFormula(objField); } }
//Import private void C_BtnImport_Click(object sender, System.EventArgs e) { this.HideCombo(); using (OpenFileDialog openFileDialog = new OpenFileDialog()) { openFileDialog.Filter = string.Format("Calculation ExportFile(*{0})|*{0}", CalculateColumnInfo.ExportFileExt); if (DialogResult.OK == openFileDialog.ShowDialog()) { if (System.IO.File.Exists(openFileDialog.FileName)) { System.IO.FileStream stream = System.IO.File.Open(openFileDialog.FileName, System.IO.FileMode.Open); try { CalculateColumnInfo calcuateColumnInfo = Webb.Utilities.Serializer.DeserializeObject(stream) as CalculateColumnInfo; if (calcuateColumnInfo != null) { this.value = calcuateColumnInfo.Copy(); this.CreateConditionTable(); this.chkDisplayClearSteps.Checked = this.value.DisplayedCalculteStep; } } catch (Exception ex) { Webb.Utilities.MessageBoxEx.ShowError("Failed to import filter!\n" + ex.Message); } finally { stream.Close(); } } } } }
private void EditValue() { if (this.nSelectedRow >= this.conditionTable.Rows.Count || this.nSelectedCol >= this.conditionTable.Columns.Count) { System.Diagnostics.Debug.WriteLine("Cell was not exsit"); return; } object value = this.C_ComboValue.Text; bool bFind = false; Type type = this.conditionTable.Columns[this.nSelectedCol].DataType; if (type.BaseType == typeof(Enum)) { foreach (object name in Enum.GetNames(type)) { if (name.ToString() == this.C_ComboValue.Text) { value = Enum.Parse(type, this.C_ComboValue.Text, true); bFind = true; break; } } if (!bFind) { value = this.conditionTable.Columns[this.nSelectedCol].DefaultValue; } } this.conditionTable.Rows[this.nSelectedRow][this.nSelectedCol] = value; }