UserActionKeyUp Event

Summary
Optional delegate method for additional processing.
Syntax
C#
C++/CLI
public event EventHandler<MedicalViewerKeyEventArgs> UserActionKeyUp 
            public: 
event EventHandler<MedicalViewerKeyEventArgs^>^ UserActionKeyUp 
Event Data

The event handler receives an argument of type MedicalViewerKeyEventArgs containing data related to this event. The following MedicalViewerKeyEventArgs properties provide information specific to this event.

PropertyDescription
ActionID Gets or sets the ID of the action that raised the event.
Alt (Inherited from System.Windows.Forms.KeyEventArgs)Gets a value indicating whether the ALT key was pressed.
CellIndex Gets or sets the value that indicates the index of the cell that received the action.
Control (Inherited from System.Windows.Forms.KeyEventArgs)Gets a value indicating whether the CTRL key was pressed.
Handled (Inherited from System.Windows.Forms.KeyEventArgs)Gets or sets a value indicating whether the event was handled.
Images Gets or sets the array of Leadtools.RasterImage objects that contain the images to be updated.
KeyCode (Inherited from System.Windows.Forms.KeyEventArgs)Gets the keyboard code for a System.Windows.Forms.Control.KeyDown or System.Windows.Forms.Control.KeyUp event.
KeyData (Inherited from System.Windows.Forms.KeyEventArgs)Gets the key data for a System.Windows.Forms.Control.KeyDown or System.Windows.Forms.Control.KeyUp event.
KeyValue (Inherited from System.Windows.Forms.KeyEventArgs)Gets the keyboard value for a System.Windows.Forms.Control.KeyDown or System.Windows.Forms.Control.KeyUp event.
Modifiers (Inherited from System.Windows.Forms.KeyEventArgs)Gets the modifier flags for a System.Windows.Forms.Control.KeyDown or System.Windows.Forms.Control.KeyUp event. The flags indicate which combination of CTRL, SHIFT, and ALT keys was pressed.
Shift (Inherited from System.Windows.Forms.KeyEventArgs)Gets a value indicating whether the SHIFT key was pressed.
SuppressKeyPress (Inherited from System.Windows.Forms.KeyEventArgs)Gets or sets a value indicating whether the key event should be passed on to the underlying control.
Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.MedicalViewer; 
 
public void MedicalViewerEventsExample() 
{ 
   MainForm3 form = new MainForm3(); 
   form.ShowDialog(); 
} 
 
// MainForm1 will be the owner of the medical viewer control. 
class MainForm3 : Form 
{ 
   private MedicalViewer _medicalViewer; 
   private bool _mouseDown; 
 
   void _medicalViewer_UserActionMouseMove(object sender, MedicalViewerMouseEventArgs e) 
   { 
      // Increase the gamma of the image as the user drags the mouse. 
      if ((e.ActionID == 101) && _mouseDown) 
      { 
         ((MedicalViewerCell)sender).Image.PaintGamma += 1; 
         ((MedicalViewerCell)sender).Invalidate(); 
      } 
   } 
 
   void _medicalViewer_UserActionMouseUp(object sender, MedicalViewerMouseEventArgs e) 
   { 
      _mouseDown = false; 
   } 
 
   void _medicalViewer_UserActionMouseDown(object sender, MedicalViewerMouseEventArgs e) 
   { 
      _mouseDown = true; 
   } 
 
   void _medicalViewer_UserActionKeyDown(object sender, MedicalViewerKeyEventArgs e) 
   { 
      if (((MedicalViewerCell)sender).Image.PaintGamma > 1) 
         ((MedicalViewerCell)sender).Image.PaintGamma -= 1; 
   } 
 
   void _medicalViewer_UserActionKeyUp(object sender, MedicalViewerKeyEventArgs e) 
   { 
      ((MedicalViewerCell)sender).Invalidate(); 
   } 
 
   void _medicalViewer_CustomPaint(object sender, MedicalViewerPaintEventArgs e) 
   { 
      // draw red ellipse around the first frame of the first cell. 
      if ((e.CellIndex == 0) && (e.SubCellIndex == 0)) 
         e.Graphics.DrawEllipse(Pens.Red, e.ClipRectangle); 
   } 
 
   void _medicalViewer_UserTag(object sender, MedicalViewerUserTagEventArgs e) 
   { 
      // draw red string at the bottom right edge of the first cell. 
      if (e.CellIndex == 0) 
         e.Graphics.DrawString("Owner Draw", new Font(FontFamily.GenericSerif, 15), Brushes.Red, new PointF(e.ClipRectangle.Left, e.ClipRectangle.Top)); 
   } 
 
   public MainForm3() 
   { 
      RasterCodecs _codecs = new RasterCodecs(); 
      RasterImage _image; 
 
      // Create the medical viewer and adjust some properties. 
      _medicalViewer = new MedicalViewer(); 
      _medicalViewer.Rows = 1; 
      _medicalViewer.Columns = 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, "image3.dcm")); 
      MedicalViewerCell cell = new MedicalViewerCell(_image, true); 
      cell.AddAction((MedicalViewerActionType)101); 
      cell.SetAction((MedicalViewerActionType)101, MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active); 
 
      cell.SetActionKeys((MedicalViewerActionType)101, new MedicalViewerKeys(Keys.Up, Keys.Down, Keys.Left, Keys.Right, MedicalViewerModifiers.None)); 
 
      cell.UserTag += new EventHandler<MedicalViewerUserTagEventArgs>(_medicalViewer_UserTag); 
      cell.CustomPaint += new EventHandler<MedicalViewerPaintEventArgs>(_medicalViewer_CustomPaint); 
      cell.UserActionMouseDown += new EventHandler<MedicalViewerMouseEventArgs>(_medicalViewer_UserActionMouseDown); 
      cell.UserActionMouseUp += new EventHandler<MedicalViewerMouseEventArgs>(_medicalViewer_UserActionMouseUp); 
      cell.UserActionMouseMove += new EventHandler<MedicalViewerMouseEventArgs>(_medicalViewer_UserActionMouseMove); 
      cell.UserActionKeyUp += new EventHandler<MedicalViewerKeyEventArgs>(_medicalViewer_UserActionKeyUp); 
      cell.UserActionKeyDown += new EventHandler<MedicalViewerKeyEventArgs>(_medicalViewer_UserActionKeyDown); 
 
      _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.SetTag(0, MedicalViewerTagAlignment.BottomRight, MedicalViewerTagType.OwnerDraw); 
 
      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.