private void tsbEditChart_Click(object sender, EventArgs e) { if (lvCharts.SelectedItems.Count == 0) return; var editor = new ChartEditor((Entity)lvCharts.SelectedItems[0].Tag, Service); editor.ShowDialog(ParentForm); if (editor.HasUpdatedContent) { lvEntities_SelectedIndexChanged(null, null); } }
public override void DoMouseUp(object sender, System.Windows.Forms.MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Right && !Locked && Rectangle.Contains(e.X, e.Y)) { if (value is ChartPainter) { ChartEditor ChartEditor = new ChartEditor(); ChartEditor.ChartPainter = this.value as ChartPainter; if (DialogResult.OK == ChartEditor.ShowDialog()) { this.value = ChartEditor.ChartPainter; (this.value as ChartPainter).UpdateDataSource(); IPainter Painter = this.value as IPainter; Picture = Painter.Paint(this.Width, this.Height); Update(); } } } }
void EditElement(object value, int RowIndex, int ColumnIndex) { GridElement Element = value as GridElement; if (Element != null) { if (Element.Value is DataColumn) { DataColumnEditor dataColumnEditor = new DataColumnEditor(Report, ActiveElement, Element); if (DialogResult.OK == dataColumnEditor.ShowDialog()) { ActiveSheet.Cells[ActiveElement].HorizontalAlignment = CellHorizontalAlignment.Center; ActiveSheet.Cells[ActiveElement].VerticalAlignment = CellVerticalAlignment.Center; ActiveSheet.Cells[ActiveElement].Value = dataColumnEditor.ReportElement; Cell Cell = ActiveSheet.Cells[ActiveElement]; Update(Cell.Row.Index, Cell.Column.Index); } } else if (Element.Value is Picture) { ImageEditor imageEditor = new ImageEditor(Report, ActiveElement, Element); if (DialogResult.OK == imageEditor.ShowDialog()) { ActiveSheet.Cells[ActiveElement].HorizontalAlignment = CellHorizontalAlignment.Center; ActiveSheet.Cells[ActiveElement].VerticalAlignment = CellVerticalAlignment.Center; ActiveSheet.Cells[ActiveElement].Value = imageEditor.ReportElement; Cell Cell = ActiveSheet.Cells[ActiveElement]; Update(Cell.Row.Index, Cell.Column.Index); } } else if (Element.Value is Slash) { SlashEditor slashEditor = new SlashEditor(Report, ActiveElement, Element); if (DialogResult.OK == slashEditor.ShowDialog()) { ActiveSheet.Cells[ActiveElement].HorizontalAlignment = CellHorizontalAlignment.Center; ActiveSheet.Cells[ActiveElement].VerticalAlignment = CellVerticalAlignment.Center; ActiveSheet.Cells[ActiveElement].Value = slashEditor.ReportElement; Cell Cell = ActiveSheet.Cells[ActiveElement]; Update(Cell.Row.Index, Cell.Column.Index); } } else if (Element.Value is Formula) { FormulaEditorUI FormulaEditorUI = new FormulaEditorUI(ActiveSheet); FormulaEditorUI.ShowInTaskbar = false; Formula Formula = Element.Value as Formula; FormulaEditorUI.SetFormula(Formula.Expression); if (DialogResult.OK == FormulaEditorUI.ShowDialog()) { Formula.Expression = FormulaEditorUI.GetFormula(); ActiveSheet.Cells[ActiveElement].Formula = FormulaEditorUI.GetFormula(); ActiveSheet.Cells[ActiveElement].HorizontalAlignment = CellHorizontalAlignment.Center; ActiveSheet.Cells[ActiveElement].VerticalAlignment = CellVerticalAlignment.Center; ActiveSheet.Cells[ActiveElement].Value = Element; Cell Cell = ActiveSheet.Cells[ActiveElement]; Update(Cell.Row.Index, Cell.Column.Index); } } else if (Element.Value is LiteralText) { Cell Cell = ActiveSheet.Cells[ActiveElement]; if (!(Cell.CellType is TextCellType)) { Cell.CellType = new TextCellType(); } EventArgs eventArgs = new EventArgs(); FpSpread.StartCellEditing(eventArgs, false); } else if (Element.Value is Variable) { VariableEditor VariableEditor = new VariableEditor(Report.Configuration.ReportParameters, Element); if (DialogResult.OK == VariableEditor.ShowDialog()) { ActiveSheet.Cells[ActiveElement].HorizontalAlignment = CellHorizontalAlignment.Center; ActiveSheet.Cells[ActiveElement].VerticalAlignment = CellVerticalAlignment.Center; ActiveSheet.Cells[ActiveElement].Value = VariableEditor.ReportElement; Cell Cell = ActiveSheet.Cells[ActiveElement]; Update(Cell.Row.Index, Cell.Column.Index); } } else if (Element.Value is ChartPainter) { ChartEditor ChartEditor = new ChartEditor(); ChartEditor.ChartPainter = Element.Value as ChartPainter; if (DialogResult.OK == ChartEditor.ShowDialog()) { Element.Value = ChartEditor.ChartPainter; Cell Cell = ActiveSheet.Cells[ActiveElement]; Update(Cell.Row.Index, Cell.Column.Index); } } } else { Cell Cell = ActiveSheet.Cells[ActiveElement]; if (!(Cell.CellType is TextCellType)) { Cell.CellType = new TextCellType(); } EventArgs eventArgs = new EventArgs(); FpSpread.StartCellEditing(eventArgs, false); } }