private void menuInsertMatrix_Click(object sender, EventArgs e) { HitLocation hl = _DrawPanel.HitContainer(_MousePosition, PointsX(_hScroll.Value), PointsY(_vScroll.Value)); if (hl == null || hl.HitContainer == null) return; // Matrixs aren't allowed in PageHeader or PageFooter if (_DrawPanel.InPageHeaderOrFooter(hl.HitContainer)) { MessageBox.Show(Strings.DesignCtl_Show_MatrixsInBody, Strings.DesignCtl_Show_Insert); return; } _Undo.StartUndoGroup(Strings.DesignCtl_Undo_InsertMatrix); DialogNewMatrix dnm = new DialogNewMatrix(this._DrawPanel, hl.HitContainer); try { DialogResult dr = dnm.ShowDialog(this); if (dr != DialogResult.OK) { _Undo.EndUndoGroup(false); return; } } finally { dnm.Dispose(); } XmlNode matrix; if (hl.HitContainer.Name == "Table" || hl.HitContainer.Name == "fyi:Grid") matrix = _DrawPanel.ReplaceTableMatrixOrChart(hl, dnm.MatrixXml); else matrix = _DrawPanel.PasteTableMatrixOrChart(hl.HitContainer, dnm.MatrixXml, hl.HitRelative); if (matrix == null) { _Undo.EndUndoGroup(false); return; } _Undo.EndUndoGroup(true); ReportChanged(this, new EventArgs()); SelectionChanged(this, new EventArgs()); ReportItemInserted(this, new EventArgs()); _DrawPanel.Invalidate(); // Now bring up the property dialog //List<XmlNode> ar = new List<XmlNode>(); //ar.Add(matrix); //_Undo.StartUndoGroup("Dialog"); //PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.ReportItems); //dr = pd.ShowDialog(this); //_Undo.EndUndoGroup(pd.Changed || dr == DialogResult.OK); //if (pd.Changed || dr == DialogResult.OK) //{ // ReportChanged(this, new EventArgs()); // _DrawPanel.Invalidate(); //} SetFocus(); }
private void menuInsertMatrix_Click(object sender, EventArgs e) { HitLocation hl = _DrawPanel.HitContainer(_MousePosition, PointsX(_hScroll.Value), PointsY(_vScroll.Value)); if (hl == null || hl.HitContainer == null) return; // Matrixs aren't allowed in PageHeader or PageFooter if (_DrawPanel.InPageHeaderOrFooter(hl.HitContainer)) { MessageBox.Show("Matrixs can only be inserted in the body of the report.", "Insert"); return; } _Undo.StartUndoGroup("Insert Matrix"); DialogNewMatrix dnm = new DialogNewMatrix(this._DrawPanel, hl.HitContainer); DialogResult dr = dnm.ShowDialog(this); if (dr != DialogResult.OK) { _Undo.EndUndoGroup(false); return; } XmlNode matrix; if (hl.HitContainer.Name == "Table") matrix = _DrawPanel.ReplaceTableMatrixOrChart(hl, dnm.MatrixXml); else matrix = _DrawPanel.PasteTableMatrixOrChart(hl.HitContainer, dnm.MatrixXml, hl.HitRelative); if (matrix == null) { _Undo.EndUndoGroup(false); return; } _Undo.EndUndoGroup(true); ReportChanged(this, new EventArgs()); SelectionChanged(this, new EventArgs()); ReportItemInserted(this, new EventArgs()); _DrawPanel.Invalidate(); // Now bring up the property dialog List<XmlNode> ar = new List<XmlNode>(); ar.Add(matrix); _Undo.StartUndoGroup("Dialog"); PropertyDialog pd = new PropertyDialog(_DrawPanel, ar, PropertyTypeEnum.ReportItems); dr = pd.ShowDialog(this); _Undo.EndUndoGroup(pd.Changed || dr == DialogResult.OK); if (pd.Changed || dr == DialogResult.OK) { ReportChanged(this, new EventArgs()); _DrawPanel.Invalidate(); } SetFocus(); }