Example #1
0
        void zedGraphControl_ContextMenuBuilder(ZedGraphControl sender, ContextMenuStrip menuStrip, Point mousePt, ZedGraphControl.ContextMenuObjectState objState)
        {
            if (ShowDataTable == null)
            {
                return;
            }

            var e = new ShowDataTableEventArgs();

            ShowDataTable(this, e);

            int index = menuStrip.Items.Cast <ToolStripMenuItem>().TakeWhile(o => o.Text != "Show Point Values").Count();

            menuStrip.Items.Insert(index,
                                   new ToolStripMenuItem("Show Data Table", null,
                                                         (x, y) =>
            {
                var tableForm = new DockableForm
                {
                    Text = this.Text + " Data Table",
                    Size = new Size(480, 600)
                };

                var dgv = new DataGridView
                {
                    Dock                  = DockStyle.Fill,
                    DataSource            = e.DataTable,
                    RowHeadersVisible     = false,
                    AllowUserToDeleteRows = false,
                    AllowUserToAddRows    = false,
                    ReadOnly              = true,
                    ClipboardCopyMode     = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText
                };
                tableForm.Controls.Add(dgv);
                tableForm.Show(this);
            }));
        }
Example #2
0
        void zedGraphControl_ContextMenuBuilder (ZedGraphControl sender, ContextMenuStrip menuStrip, Point mousePt, ZedGraphControl.ContextMenuObjectState objState)
        {
            if (ShowDataTable == null)
                return;

            var e = new ShowDataTableEventArgs();
            ShowDataTable(this, e);

            int index = menuStrip.Items.Cast<ToolStripMenuItem>().TakeWhile(o => o.Text != "Show Point Values").Count();
            menuStrip.Items.Insert(index,
                new ToolStripMenuItem("Show Data Table", null,
                (x, y) =>
                {
                    var tableForm = new DockableForm
                    {
                        Text = this.Text + " Data Table",
                        Size = new Size(480, 600)
                    };

                    var dgv = new DataGridView
                    {
                        Dock = DockStyle.Fill,
                        DataSource = e.DataTable,
                        RowHeadersVisible = false,
                        AllowUserToDeleteRows = false,
                        AllowUserToAddRows = false,
                        ReadOnly = true,
                        ClipboardCopyMode = DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText
                    };
                    tableForm.Controls.Add(dgv);
                    tableForm.Show(this);
                }));
        }