LEADTOOLS Medical (Leadtools.MedicalViewer assembly)

MedicalViewer Constructor()

Show in webframe





Initializes a new instance of the MedicalViewer class.
Syntax
public MedicalViewer()
'Declaration
 
Public Function New()
'Usage
 
Dim instance As New MedicalViewer()

            

            
public:
MedicalViewer();
Example
        Imports Leadtools
        Imports Leadtools.Codecs
        Imports Leadtools.MedicalViewer

        Public Sub MedicalViewerPropertiesExample()
            Dim form As MainForm2 = New MainForm2()
            form.ShowDialog()
        End Sub

        ' MainForm1 will be the owner of the medical viewer control.
        Private Class MainForm2 : Inherits Form
            Public _medicalViewer As MedicalViewer

            Private Sub MedicalViewerForm_SizeChanged(ByVal sender As Object, ByVal e As EventArgs)
                _medicalViewer.Size = New Size(Me.ClientRectangle.Right, Me.ClientRectangle.Bottom)
            End Sub

            Public Sub New()
                Dim _codecs As RasterCodecs = New RasterCodecs()
                Dim _image As RasterImage

                ' 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(Me.ClientRectangle.Right, Me.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"))
                Dim cell As MedicalViewerMultiCell = 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 keyboard keys that will work like the mouse.
                Dim medicalKeys As MedicalViewerKeys = 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 haven't been assigned to a mouse button, or a key.
                Dim index As Integer = 1
                Do While index < 22
                    Dim actionType As MedicalViewerActionType = CType(index, MedicalViewerActionType)
                    If cell.IsActionAdded(actionType) Then
                        Dim mouseButton As MedicalViewerMouseButtons = cell.GetActionButton(actionType)
                        If mouseButton = MedicalViewerMouseButtons.None Then
                            Dim mykeys As MedicalViewerKeys = cell.GetActionKeys(actionType)
                            If mykeys.MouseLeft = Keys.None AndAlso mykeys.MouseUp = Keys.None AndAlso mykeys.MouseDown = Keys.None AndAlso mykeys.MouseRight = Keys.None Then
                                cell.RemoveAction(actionType)
                            End If
                        End If
                    End If
                    index += 1
                Loop

                ' Makes the window level apply the effect on all selected cells at the same time.
                Dim flags As MedicalViewerActionFlags = cell.GetActionFlags(MedicalViewerActionType.WindowLevel)
                flags = flags Or 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"))
                Dim cell1 As MedicalViewerMultiCell = 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 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
            End Sub
        End Class

        Public NotInheritable Class LEAD_VARS
        Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
        End Class
      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:\Users\Public\Documents\LEADTOOLS Images";
      }

        Imports Leadtools
        Imports Leadtools.Codecs
        Imports Leadtools.MedicalViewer

        Public Sub MedicalViewerPropertiesExample()
            Dim form As MainForm2 = New MainForm2()
            form.ShowDialog()
        End Sub

        ' MainForm1 will be the owner of the medical viewer control.
        Private Class MainForm2 : Inherits Form
            Public _medicalViewer As MedicalViewer

            Private Sub MedicalViewerForm_SizeChanged(ByVal sender As Object, ByVal e As EventArgs)
                _medicalViewer.Size = New Size(Me.ClientRectangle.Right, Me.ClientRectangle.Bottom)
            End Sub

            Public Sub New()
                Dim _codecs As RasterCodecs = New RasterCodecs()
                Dim _image As RasterImage

                ' 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(Me.ClientRectangle.Right, Me.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"))
                Dim cell As MedicalViewerMultiCell = 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 keyboard keys that will work like the mouse.
                Dim medicalKeys As MedicalViewerKeys = 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 haven't been assigned to a mouse button, or a key.
                Dim index As Integer = 1
                Do While index < 22
                    Dim actionType As MedicalViewerActionType = CType(index, MedicalViewerActionType)
                    If cell.IsActionAdded(actionType) Then
                        Dim mouseButton As MedicalViewerMouseButtons = cell.GetActionButton(actionType)
                        If mouseButton = MedicalViewerMouseButtons.None Then
                            Dim mykeys As MedicalViewerKeys = cell.GetActionKeys(actionType)
                            If mykeys.MouseLeft = Keys.None AndAlso mykeys.MouseUp = Keys.None AndAlso mykeys.MouseDown = Keys.None AndAlso mykeys.MouseRight = Keys.None Then
                                cell.RemoveAction(actionType)
                            End If
                        End If
                    End If
                    index += 1
                Loop

                ' Makes the window level apply the effect on all selected cells at the same time.
                Dim flags As MedicalViewerActionFlags = cell.GetActionFlags(MedicalViewerActionType.WindowLevel)
                flags = flags Or 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"))
                Dim cell1 As MedicalViewerMultiCell = 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 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
            End Sub
        End Class

        Public NotInheritable Class LEAD_VARS
        Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
        End Class
      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:\Users\Public\Documents\LEADTOOLS Images";
      }

      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:\Users\Public\Documents\LEADTOOLS Images";
      }

Requirements

Target Platforms

See Also

Reference

MedicalViewer Class
MedicalViewer Members
Overload List

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.MedicalViewer requires a Medical Imaging license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features