MedicalViewer Constructor(int,int)

Summary
Initializes a new instance of a MedicalViewer object with explicit parameters.
Syntax
C#
C++/CLI
public MedicalViewer( 
   int rows, 
   int columns 
) 
            public: 
MedicalViewer(  
   int rows, 
   int columns 
) 

Parameters

rows
The number of rows. The maximum allowed number of rows is 8.

columns
The number of columns. The maximum allowed number of columns is 8.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.MedicalViewer; 
 
public void MedicalViewerExample() 
{ 
   MainForm1 form = new MainForm1(); 
   form.ShowDialog(); 
} 
 
// MainForm1 will be the owner of the medical viewer control. 
class MainForm1 : Form 
{ 
   private MedicalViewer _medicalViewer; 
 
   void MedicalViewerForm_SizeChanged(object sender, EventArgs e) 
   { 
      _medicalViewer.Size = new Size(this.ClientRectangle.Right, this.ClientRectangle.Bottom); 
   } 
 
   public MainForm1() 
   { 
      RasterCodecs _codecs = new RasterCodecs(); 
      RasterImage _image; 
 
      // Create the medical viewer and adjust the size and the location. 
      _medicalViewer = new MedicalViewer(1, 2); 
      _medicalViewer.Location = new Point(0, 0); 
      _medicalViewer.Size = new Size(this.ClientRectangle.Right, this.ClientRectangle.Bottom); 
 
      // Load an image and then add it to the control. 
      _image = _codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, @"ImageProcessingDemo\Image3.cmp")); 
 
      MedicalViewerMultiCell cell = new MedicalViewerMultiCell(_image, true, 1, 1); 
 
      // add some actions that will be used to change the properties of the images inside the control. 
      cell.AddAction(MedicalViewerActionType.WindowLevel); 
      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(Keys.Down, Keys.Up, Keys.Left, Keys.Right, MedicalViewerModifiers.None); 
      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); 
 
      _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 = 1; 
      cell.Columns = 1; 
      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(_image); 
      _medicalViewer.Cells.Add(cell1); 
 
 
      // add some actions that will be used to change the properties of the images inside the control. 
      cell1.AddAction(MedicalViewerActionType.WindowLevel); 
      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(Keys.Down, Keys.Up, Keys.Left, Keys.Right, MedicalViewerModifiers.None); 
      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 of the cell 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); 
      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; 
 
      Controls.Add(_medicalViewer); 
      _medicalViewer.Dock = DockStyle.Fill; 
   } 
} 
 
static class LEAD_VARS 
{ 
   public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images"; 
} 
Requirements

Target Platforms

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

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