GdPicture.NET.14
GdPicture14 Namespace / GdViewer Class / SetItemMenuEnabled Method
Set this parameter to true if you want to enable the specified menu item. If you set this parameter to false, the specified menu item will be disabled.
Example





In This Topic
SetItemMenuEnabled Method (GdViewer)
In This Topic
Enables or disables the specified contextual menu item. The available menu items are listed below.

The context menu is only available if some document is displayed in the GdViewer control. Please note that the toolkit does not support adding custom menu items right now.

You can control displaying the menu in the GdViewer control by using the EnableMenu property.

Syntax
'Declaration
 
Public Sub SetItemMenuEnabled( _
   ByVal MenuItemIdx As Integer, _
   ByVal Enable As Boolean _
) 
public void SetItemMenuEnabled( 
   int MenuItemIdx,
   bool Enable
)
public procedure SetItemMenuEnabled( 
    MenuItemIdx: Integer;
    Enable: Boolean
); 
public function SetItemMenuEnabled( 
   MenuItemIdx : int,
   Enable : boolean
);
public: void SetItemMenuEnabled( 
   int MenuItemIdx,
   bool Enable
) 
public:
void SetItemMenuEnabled( 
   int MenuItemIdx,
   bool Enable
) 

Parameters

MenuItemIdx
The index of the menu item to enable or disable. The available values representing individual menu items are listed below (please see the corresponding ordering number for each menu item):
  1. Pages / Frames
  2. Pages / Frames -> Goto First
  3. Pages / Frames -> Goto Previous
  4. Pages / Frames -> Goto Next
  5. Pages / Frames -> Goto Last
  6. Play Gif
  7. Stop Gif Animation
  8. Rotations - Flips
  9. Rotations - Flips -> Rotate 90°
  10. Rotations - Flips -> Rotate 180°
  11. Rotations - Flips -> Rotate 270°
  12. Rotations - Flips -> Flip X
  13. Rotations - Flips -> RotateFlip 90°
  14. Rotations - Flips -> RotateFlip 180°
  15. Rotations - Flips -> RotateFlip 270°
  16. ScrollBars
  17. Copy Bitmap to Clipboard
  18. Zoom
  19. Zoom -> Zoom in
  20. Zoom -> Zoom out
  21. Zoom -> Zoom 100%
  22. Zoom -> Zoom to selected area
  23. Zoom -> Fit image to viewer (keep aspect ratio)
  24. Zoom -> Fit image to viewer (don't keep aspect ratio)
  25. Zoom -> Fit image to viewer width
  26. Zoom -> Fit image to viewer height
  27. Mouse Mode
  28. Mouse Mode -> Nothing
  29. Mouse Mode -> Hand Pan Tool
  30. Mouse Mode -> Area Selection Tool
  31. Left Click -> Area Zooming Tool
  32. Viewer Quality
  33. Viewer Quality -> Automatic
  34. Viewer Quality -> Quality Low
  35. Viewer Quality -> Quality Bilinear
  36. Viewer Quality -> Quality Bicubic
  37. Viewer Quality -> Quality Bilinear HQ
  38. Viewer Quality -> Quality Bicubic HQ
  39. Mouse Mode -> Magnifier Tool
  40. Copy Text to Clipboard
  41. Shrink image to viewer width
Enable
Set this parameter to true if you want to enable the specified menu item. If you set this parameter to false, the specified menu item will be disabled.
Remarks
Please note that the context menu is only available if some document is displayed in the GdViewer control. Enabling or disabling menu items or changing their properties is possible without any limitations.

Be aware that the toolkit does not support adding custom menu items.

Example
How to enable or disable the contextual menu items.
'We assume that the GdViewer1 control has been properly integrated.
If GdViewer1.DisplayFromFile("") = GdPictureStatus.OK Then
    If GdViewer1.GetLastPath().EndsWith(".gif") Then
        GdViewer1.SetItemMenuCaption(6, "PLAY GIF ANIMATION")
        GdViewer1.SetItemMenuCaption(7, "STOP GIF ANIMATION")
        GdViewer1.SetItemMenuEnabled(1, False)
        GdViewer1.SetItemMenuEnabled(8, False)
        GdViewer1.SetItemMenuEnabled(16, False)
    Else
        GdViewer1.RemoveItemMenu(6)
        GdViewer1.RemoveItemMenu(7)
    End If
Else
    MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetItemMenuEnabled")
End If
//We assume that the GdViewer1 control has been properly integrated.
if (GdViewer1.DisplayFromFile("") == GdPictureStatus.OK)
{
    if (GdViewer1.GetLastPath().EndsWith(".gif"))
    {
        GdViewer1.SetItemMenuCaption(6, "PLAY GIF ANIMATION");
        GdViewer1.SetItemMenuCaption(7, "STOP GIF ANIMATION");
        GdViewer1.SetItemMenuEnabled(1, false);
        GdViewer1.SetItemMenuEnabled(8, false);
        GdViewer1.SetItemMenuEnabled(16, false);
    }
    else
    {
        GdViewer1.RemoveItemMenu(6);
        GdViewer1.RemoveItemMenu(7);
    }
}
else
    MessageBox.Show("The file can't be displayed. Status: " + GdViewer1.GetStat().ToString(), "GdViewer.SetItemMenuEnabled");
See Also