Exemplo n.º 1
0
		private void menuInsertTable_Click(object sender, EventArgs e)
		{
			HitLocation hl = _DrawPanel.HitContainer(_MousePosition, 
				PointsX(_hScroll.Value), PointsY(_vScroll.Value));
			if (hl == null || hl.HitContainer == null)
				return;
			
			// Tables aren't allowed in PageHeader or PageFooter
			if (_DrawPanel.InPageHeaderOrFooter(hl.HitContainer))
			{
				MessageBox.Show(Strings.DesignCtl_Show_TablesInBody, Strings.DesignCtl_Show_Insert);
				return;
			}

			_Undo.StartUndoGroup(Strings.DesignCtl_Undo_InsertTable);
			DialogNewTable dnt = new DialogNewTable(this._DrawPanel, hl.HitContainer);
            try
            {
                DialogResult dr = dnt.ShowDialog(this);
                if (dr != DialogResult.OK)
                {
                    _Undo.EndUndoGroup(false);
                    return;
                }
            }
            finally
            {
                dnt.Dispose();
            }
			XmlNode table;
			if (hl.HitContainer.Name == "Table" || hl.HitContainer.Name == "fyi:Grid")
				table = _DrawPanel.ReplaceTableMatrixOrChart(hl, dnt.TableXml);
			else
				table = _DrawPanel.PasteTableMatrixOrChart(hl.HitContainer, dnt.TableXml, hl.HitRelative);
			if (table == 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(table);
            //_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();
		}
Exemplo n.º 2
0
		private void menuInsertTable_Click(object sender, EventArgs e)
		{
			HitLocation hl = _DrawPanel.HitContainer(_MousePosition, 
				PointsX(_hScroll.Value), PointsY(_vScroll.Value));
			if (hl == null || hl.HitContainer == null)
				return;
			
			// Tables aren't allowed in PageHeader or PageFooter
			if (_DrawPanel.InPageHeaderOrFooter(hl.HitContainer))
			{
				MessageBox.Show("Tables can only be inserted in the body of the report.", "Insert");
				return;
			}

			_Undo.StartUndoGroup("Insert Table");
			DialogNewTable dnt = new DialogNewTable(this._DrawPanel, hl.HitContainer);
			DialogResult dr = dnt.ShowDialog(this);
			if (dr != DialogResult.OK)
			{
				_Undo.EndUndoGroup(false);
				return;
			}
			XmlNode table;
			if (hl.HitContainer.Name == "Table")
				table = _DrawPanel.ReplaceTableMatrixOrChart(hl, dnt.TableXml);
			else
				table = _DrawPanel.PasteTableMatrixOrChart(hl.HitContainer, dnt.TableXml, hl.HitRelative);
			if (table == 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(table);
			_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();
		}