Is this page helpful?

In this page

RemoveAction Method

Summary
Removes the specified action from the medical viewer.
Syntax
C#
C++/CLI
public virtual void RemoveAction( 
   MedicalViewerActionType actionType 
) 
            public: 
virtual void RemoveAction(  
   MedicalViewerActionType actionType 
)  

Parameters

actionType
The action to be removed.

Remarks

When an action is removed from a container, all properties, mouse buttons, and keystroke combinations are also removed.

Example
C#
Copied to clipboard
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.MedicalViewer; 
 
public void MedicalViewerPropertiesExample() 
{ 
   MainForm2 form = new MainForm2(); 
   form.ShowDialog(); 
} 
 
// MainForm1 will be the owner of the medical viewer control. 
class MainForm2 : Form 
{ 
   public MedicalViewer _medicalViewer; 
 
   void MedicalViewerForm_SizeChanged(object sender, EventArgs e) 
   { 
      _medicalViewer.Size = new Size(this.ClientRectangle.Right, this.ClientRectangle.Bottom); 
   } 
 
   public MainForm2() 
   { 
      RasterCodecs _codecs = new RasterCodecs(); 
      RasterImage _image; 
 
      // Create the medical viewer and adjust some properties. 
      _medicalViewer = new MedicalViewer(); 
      _medicalViewer.Rows = 2; 
      _medicalViewer.Columns = 2; 
      _medicalViewer.Location = new Point(0, 0); 
      _medicalViewer.Size = new Size(this.ClientRectangle.Right, this.ClientRectangle.Bottom); 
      _medicalViewer.ResizeBoth = System.Windows.Forms.Cursors.SizeAll; 
      _medicalViewer.ResizeHorizontalCursor = System.Windows.Forms.Cursors.SizeWE; 
      _medicalViewer.ResizeVerticalCursor = System.Windows.Forms.Cursors.SizeNS; 
      _medicalViewer.SplitterColor = Color.FromArgb(128, 128, 128); 
      _medicalViewer.SplitterStyle = MedicalViewerSplitterStyle.Thick; 
      _medicalViewer.UseExtraSplitters = false; 
      _medicalViewer.VisibleRow = 0; 
      _medicalViewer.CellMaintenance = true; 
      _medicalViewer.CustomSplitterColor = true; 
      _medicalViewer.AutoScroll = true; 
 
      // Load an image and then add it to the control. 
      _image = _codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "xa.dcm")); 
      MedicalViewerMultiCell cell = new MedicalViewerMultiCell(_image, true, 1, 1); 
 
      cell.ActiveBorderColor = Color.FromArgb(0, 0, 255); 
      cell.ActiveSubCellBorderColor = Color.FromArgb(0, 255, 0); 
      cell.AnnotationDefaultCursor = System.Windows.Forms.Cursors.Cross; 
      cell.AnnotationMoveCursor = System.Windows.Forms.Cursors.SizeNWSE; 
      cell.AnnotationSelectCursor = System.Windows.Forms.Cursors.SizeAll; 
 
      cell.CellBackColor = Color.FromArgb(100, 100, 255); 
      cell.BorderStyle = MedicalViewerBorderStyle.DashDotDot; 
      cell.BackColor = Color.FromArgb(70, 70, 180); 
      cell.MeasurementUnit = MedicalViewerMeasurementUnit.Inches; 
      cell.NonActiveBorderColor = Color.FromArgb(0, 0, 0); 
      cell.PaintingMethod = MedicalViewerPaintingMethod.Normal; 
      cell.RegionDefaultCursor = System.Windows.Forms.Cursors.Cross; 
 
      cell.RulerInColor = Color.FromArgb(255, 255, 0); 
      cell.RulerOutColor = Color.FromArgb(255, 0, 0); 
      cell.RulerStyle = MedicalViewerRulerStyle.Bordered; 
      cell.ShowCellScroll = false; 
      cell.ShowFreezeText = true; 
      cell.TextColor = Color.FromArgb(255, 255, 0); 
      cell.TextQuality = MedicalViewerTextQuality.Draft; 
      cell.TextShadowColor = Color.FromArgb(0, 0, 0); 
      cell.OverlayTextSize = 0; 
      cell.RegionBorderColor1 = Color.FromArgb(0, 0, 255); 
      cell.RegionBorderColor2 = Color.FromArgb(255, 255, 255); 
      cell.InteractiveInterpolation = true; 
 
      // add some actions that will be used to change the properties of the images inside the control. 
      cell.AddAction(MedicalViewerActionType.WindowLevel); 
      cell.AddAction(MedicalViewerActionType.Alpha); 
      cell.AddAction(MedicalViewerActionType.Scale); 
      cell.AddAction(MedicalViewerActionType.Offset); 
      cell.AddAction(MedicalViewerActionType.Stack); 
 
      // assign the added actions to a mouse button, meaning that when the user clicks and drags the mouse button, the associated action will be activated. 
      cell.SetAction(MedicalViewerActionType.WindowLevel, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active); 
      cell.SetAction(MedicalViewerActionType.Offset, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active); 
      cell.SetAction(MedicalViewerActionType.Scale, MedicalViewerMouseButtons.Middle, MedicalViewerActionFlags.Active); 
      cell.SetAction(MedicalViewerActionType.Stack, MedicalViewerMouseButtons.Wheel, MedicalViewerActionFlags.Active); 
 
      // assign the added actions to a keyboard keys that will work like the mouse. 
      MedicalViewerKeys medicalKeys = new MedicalViewerKeys(); 
      medicalKeys.MouseDown = Keys.Down; 
      medicalKeys.MouseUp = Keys.Up; 
      medicalKeys.MouseLeft = Keys.Left; 
      medicalKeys.MouseRight = Keys.Right; 
      cell.SetActionKeys(MedicalViewerActionType.Offset, medicalKeys); 
      medicalKeys.Modifiers = MedicalViewerModifiers.Ctrl; 
      cell.SetActionKeys(MedicalViewerActionType.WindowLevel, medicalKeys); 
      medicalKeys.MouseDown = Keys.PageDown; 
      medicalKeys.MouseUp = Keys.PageUp; 
      cell.SetActionKeys(MedicalViewerActionType.Stack, medicalKeys); 
      medicalKeys.MouseDown = Keys.Subtract; 
      medicalKeys.MouseUp = Keys.Add; 
      cell.SetActionKeys(MedicalViewerActionType.Scale, medicalKeys); 
 
      // Go through all the built in actions and remove the actions that have not been assigned to a mouse button, or a key. 
      int index = 1; 
      for (; index < 22; index++) 
      { 
         MedicalViewerActionType actionType = (MedicalViewerActionType)index; 
         if (cell.IsActionAdded(actionType)) 
         { 
            MedicalViewerMouseButtons mouseButton = cell.GetActionButton(actionType); 
            if (mouseButton == MedicalViewerMouseButtons.None) 
            { 
               MedicalViewerKeys keys = cell.GetActionKeys(actionType); 
               if (keys.MouseLeft == Keys.None && keys.MouseUp == Keys.None && keys.MouseDown == Keys.None && keys.MouseRight == Keys.None) 
                  cell.RemoveAction(actionType); 
            } 
         } 
      } 
 
      // Makes the window level applies the effect on all selected cells at the same time. 
      MedicalViewerActionFlags flags = cell.GetActionFlags(MedicalViewerActionType.WindowLevel); 
      flags |= MedicalViewerActionFlags.Selected; 
      cell.SetAction(MedicalViewerActionType.WindowLevel, MedicalViewerMouseButtons.Left, flags); 
 
 
      // Load an image and then add it to the control. 
      _image = _codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "image2.cmp")); 
      _medicalViewer.Cells.Add(cell); 
 
      // adjust some properties of the cell and add some tags. 
      cell.SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "EX. ID 230-36-5448"); 
      cell.SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame); 
      cell.SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale); 
      cell.SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData); 
      cell.SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView); 
      cell.SetTag(1, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Good, Guy"); 
      cell.SetTag(2, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "PID 125-98-445"); 
      cell.SetTag(3, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "DOB 08/02/1929"); 
      cell.SetTag(5, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "03/16/1999"); 
      cell.SetTag(0, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.RulerUnit); 
      cell.Rows = 2; 
      cell.Columns = 2; 
      cell.Frozen = false; 
      cell.DisplayRulers = MedicalViewerRulers.Both; 
      cell.ApplyOnIndividualSubCell = false; 
      cell.ApplyActionOnMove = true; 
      cell.FitImageToCell = true; 
      cell.Selected = true; 
      cell.ShowTags = true; 
 
      // Load an image and then add it to the control. 
      _image = _codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "image2.cmp")); 
      MedicalViewerMultiCell cell1 = new MedicalViewerMultiCell(); 
      cell1.Image = _image; 
      cell1.Rows = 2; 
      cell1.Columns = 2; 
      cell1.Frozen = false; 
      cell1.DisplayRulers = MedicalViewerRulers.Both; 
      cell1.ApplyOnIndividualSubCell = false; 
      cell1.ApplyActionOnMove = true; 
      cell1.FitImageToCell = true; 
      cell1.Selected = true; 
      cell1.ShowTags = true; 
      _medicalViewer.Cells.Add(cell1); 
 
      cell1.CellBackColor = Color.FromArgb(100, 100, 255); 
      cell1.BorderStyle = MedicalViewerBorderStyle.DashDotDot; 
      cell1.BackColor = Color.FromArgb(70, 70, 180); 
      cell1.MeasurementUnit = MedicalViewerMeasurementUnit.Inches; 
      cell1.NonActiveBorderColor = Color.FromArgb(0, 0, 0); 
      cell1.PaintingMethod = MedicalViewerPaintingMethod.Normal; 
      cell1.RegionDefaultCursor = System.Windows.Forms.Cursors.Cross; 
 
      cell1.RulerInColor = Color.FromArgb(255, 255, 0); 
      cell1.RulerOutColor = Color.FromArgb(255, 0, 0); 
      cell1.RulerStyle = MedicalViewerRulerStyle.Bordered; 
      cell1.ShowCellScroll = false; 
      cell1.ShowFreezeText = true; 
      cell1.TextColor = Color.FromArgb(255, 255, 0); 
      cell1.TextQuality = MedicalViewerTextQuality.Draft; 
      cell1.TextShadowColor = Color.FromArgb(0, 0, 0); 
      cell1.OverlayTextSize = 0; 
      cell1.RegionBorderColor1 = Color.FromArgb(0, 0, 255); 
      cell1.RegionBorderColor2 = Color.FromArgb(255, 255, 255); 
      cell1.InteractiveInterpolation = true; 
 
      // add some actions that will be used to change the properties of the images inside the control. 
      cell1.AddAction(MedicalViewerActionType.WindowLevel); 
      cell1.AddAction(MedicalViewerActionType.Alpha); 
      cell1.AddAction(MedicalViewerActionType.Scale); 
      cell1.AddAction(MedicalViewerActionType.Offset); 
      cell1.AddAction(MedicalViewerActionType.Stack); 
 
      // assign the added actions to a mouse button, meaning that when the user clicks and drags the mouse button, the associated action will be activated. 
      cell1.SetAction(MedicalViewerActionType.WindowLevel, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active); 
      cell1.SetAction(MedicalViewerActionType.Offset, MedicalViewerMouseButtons.Right, MedicalViewerActionFlags.Active); 
      cell1.SetAction(MedicalViewerActionType.Scale, MedicalViewerMouseButtons.Middle, MedicalViewerActionFlags.Active); 
      cell1.SetAction(MedicalViewerActionType.Stack, MedicalViewerMouseButtons.Wheel, MedicalViewerActionFlags.Active); 
 
      // assign the added actions to a keyboard keys that will work like the mouse. 
      medicalKeys = new MedicalViewerKeys(); 
      medicalKeys.MouseDown = Keys.Down; 
      medicalKeys.MouseUp = Keys.Up; 
      medicalKeys.MouseLeft = Keys.Left; 
      medicalKeys.MouseRight = Keys.Right; 
      cell1.SetActionKeys(MedicalViewerActionType.Offset, medicalKeys); 
      medicalKeys.Modifiers = MedicalViewerModifiers.Ctrl; 
      cell1.SetActionKeys(MedicalViewerActionType.WindowLevel, medicalKeys); 
      medicalKeys.MouseDown = Keys.PageDown; 
      medicalKeys.MouseUp = Keys.PageUp; 
      cell1.SetActionKeys(MedicalViewerActionType.Stack, medicalKeys); 
      medicalKeys.MouseDown = Keys.Subtract; 
      medicalKeys.MouseUp = Keys.Add; 
      cell1.SetActionKeys(MedicalViewerActionType.Scale, medicalKeys); 
 
      // adjust some properties to the cell1 and add some tags. 
      cell1.SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "EX. ID 230-36-5448"); 
      cell1.SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame); 
      cell1.SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale); 
      cell1.SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData); 
      cell1.SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView); 
      cell1.SetTag(1, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Good, Guy"); 
      cell1.SetTag(2, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "PID 125-98-445"); 
      cell1.SetTag(3, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "DOB 08/02/1929"); 
      cell1.SetTag(5, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "03/16/1999"); 
      cell1.SetTag(0, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.RulerUnit); 
 
      Controls.Add(_medicalViewer); 
      _medicalViewer.Dock = DockStyle.Fill; 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images"; 
} 
Requirements

Target Platforms

Help Version 22.0.2023.2.5
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.MedicalViewer Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.