ActiveReports 6 Support

Started by zyengman at 02-04-2010 3:45 PM. Topic has 1 replies.

Print Search Rate
Sort Posts:    
   02-04-2010, 3:45 PM
zyengman is not online. Last active: 2/10/2010 9:54:59 AM zyengman

Not Ranked
Joined on 01-19-2010
Posts 1
Customize the Context Menu
Hi,

I am looking to do what was done in this article (Scroll to the 2nd to last post in the forum which I also pasted below) in Active Reports 6:  http://www.datadynamics.com/forums/108463/ShowPost.aspx

Private Sub arDesigner_ContextMenuOpen(ByVal sender As Object, ByVal e As DataDynamics.ActiveReports.Design.ContextMenuOpenArgs) Handles arDesigner.ContextMenuOpen
        'The user right-clicked a control
        If Me.arDesigner.Selection(0).GetType.BaseType.ToString = "DataDynamics.ActiveReports.ARControl" Then
            If _isContextMenuOpen Then
                _isContextMenuOpen = False
            Else
                'Cancel the normal context menu
                e.Cancel = True
                Dim ctrlContextMenu As CommandBarContextMenu = New CommandBarContextMenu()
     
                'add Cut to context menu
                ctrlContextMenu.Items.Add(commandBarManager.CommandBars.Item(2).Items(0))

                'add Copy to context menu
                ctrlContextMenu.Items.Add(commandBarManager.CommandBars.Item(2).Items(1))

                'add Paste to context menu
                ctrlContextMenu.Items.Add(commandBarManager.CommandBars.Item(2).Items(2))

                'add Delete to context menu
                ctrlContextMenu.Items.Add(commandBarManager.CommandBars.Item(2).Items(3))

                ctrlContextMenu.Items.AddSeparator()

                'add Bring to Front to context menu
                ctrlContextMenu.Items.Add(commandBarManager.CommandBars.Item(6).Items(10))

                'add Send to Back to context menu
                ctrlContextMenu.Items.Add(commandBarManager.CommandBars.Item(6).Items(11))

                ctrlContextMenu.Items.AddSeparator()

                Me.arDesigner.ContextMenu = ctrlContextMenu

                'display the controls' context menu
                Dim x As Integer = Control.MousePosition.X
                Dim y As Integer = Control.MousePosition.Y
                Me.arDesigner.ShowContextMenu(ctrlContextMenu, New Point(x, y))
                _isContextMenuOpen = True
            End If
        End If

    End Sub



   Report 
   02-08-2010, 2:47 AM
AnkitN is not online. Last active: 12/15/2009 10:29:52 PM AnkitN

Top 25 Posts
Joined on 03-03-2009
Posts 758

DDStaff
Re: Customize the Context Menu
You can use the following code in ActiveReports 6 Designer to customize the context menu:

void arDesigner_ContextMenuOpen(object sender, ContextMenuOpenArgs e)
{
            if (isContextMenuOpen)
                isContextMenuOpen = false;
            else
            {
                e.Cancel = true;

System.Windows.Forms.ContextMenuStrip cntxtMenu = new ContextMenuStrip();                cntxtMenu.Items.Add("Copy");
cntxtMenu.Items.Add("Paset");  
cntxtMenu.Items[0].Click+=new EventHandler(CopyMenu_Click);
cntxtMenu.Items[1].Click+=new EventHandler(PasteMenu_Click);
arDesigner.ContextMenuStrip = cntxtMenu;
arDesigner.ContextMenuStrip.Show(this, new System.Drawing.Point(Control.MousePosition.X, Control.MousePosition.Y));
isContextMenuOpen = true;

            }
 }

 void CopyMenu_Click(object sender, EventArgs e)
 {
     if(arDesigner.QueryActionEnabled(DesignerAction.EditCopy))
            {
               arDesigner.ExecuteAction(DesignerAction.EditCopy);
            }
}

 void PasteMenu_Click(object sender, EventArgs e)
 {
     if(arDesigner.QueryActionEnabled(DesignerAction.EditPaste))
            {
               arDesigner.ExecuteAction(DesignerAction.EditPaste);
            }       
}

Regards,
Ankit Nigam


   Report 
GrapeCity » Product Support » ActiveReports 6... » Customize the Context Menu

Privacy Policy | Copyright © 1997-2010 - GrapeCity, inc.