<Test> _
Public Sub MedicalViewerEventsExample()
Dim form As MainForm2 = New MainForm2()
form.ShowDialog()
End Sub
Private Class MainForm3 : Inherits Form
Private _medicalViewer As MedicalViewer
Private _mouseDown As Boolean
Private Sub _medicalViewer_UserActionMouseMove(ByVal sender As Object, ByVal e As MedicalViewerMouseEventArgs)
If (e.CellIndex = 0) AndAlso (e.ActionID = 101) AndAlso _mouseDown Then
e.Images(0).PaintGamma += 100
End If
End Sub
Private Sub _medicalViewer_UserActionMouseUp(ByVal sender As Object, ByVal e As MedicalViewerMouseEventArgs)
_mouseDown = False
End Sub
Private Sub _medicalViewer_UserActionMouseDown(ByVal sender As Object, ByVal e As MedicalViewerMouseEventArgs)
_mouseDown = True
End Sub
Private Sub _medicalViewer_UserActionKeyDown(ByVal sender As Object, ByVal e As MedicalViewerKeyEventArgs)
If (e.ActionID = 101) AndAlso (e.CellIndex = 0) AndAlso _mouseDown Then
e.Images(0).PaintGamma -= 10
End If
End Sub
Private Sub _medicalViewer_UserActionKeyUp(ByVal sender As Object, ByVal e As MedicalViewerKeyEventArgs)
If (e.ActionID = 101) AndAlso (e.CellIndex = 0) AndAlso _mouseDown Then
e.Images(0).PaintGamma += 10
End If
End Sub
Private Sub _medicalViewer_CustomPaint(ByVal sender As Object, ByVal e As MedicalViewerPaintEventArgs)
If (e.CellIndex = 0) AndAlso (e.SubCellIndex = 0) Then
e.Graphics.DrawEllipse(Pens.Red, e.ClipRectangle)
End If
End Sub
Private Sub _medicalViewer_UserTag(ByVal sender As Object, ByVal e As MedicalViewerUserTagEventArgs)
If e.CellIndex = 0 Then
e.Graphics.DrawString("Owner Draw", New Font(FontFamily.GenericSerif, 15), Brushes.Red, New PointF(e.ClipRectangle.Left, e.ClipRectangle.Top))
End If
End Sub
Public Sub New()
RasterCodecs.Startup()
Dim _codecs As RasterCodecs = New RasterCodecs()
Dim _image As RasterImage
_medicalViewer = New MedicalViewer()
_medicalViewer.Rows = 1
_medicalViewer.Columns = 2
_medicalViewer.Location = New Point(0, 0)
_medicalViewer.Size = New Size(Me.ClientRectangle.Right, Me.ClientRectangle.Bottom)
_medicalViewer.AddAction(CType(101, MedicalViewerActionType))
_medicalViewer.SetAction(CType(101, MedicalViewerActionType), MedicalViewerMouseButtons.Left, MedicalViewerActionFlags.Active Or MedicalViewerActionFlags.RealTime)
AddHandler _medicalViewer.UserTag, AddressOf _medicalViewer_UserTag
AddHandler _medicalViewer.CustomPaint, AddressOf _medicalViewer_CustomPaint
AddHandler _medicalViewer.UserActionMouseDown, AddressOf _medicalViewer_UserActionMouseDown
AddHandler _medicalViewer.UserActionMouseUp, AddressOf _medicalViewer_UserActionMouseUp
AddHandler _medicalViewer.UserActionMouseMove, AddressOf _medicalViewer_UserActionMouseMove
AddHandler _medicalViewer.UserActionKeyUp, AddressOf _medicalViewer_UserActionKeyUp
AddHandler _medicalViewer.UserActionKeyDown, AddressOf _medicalViewer_UserActionKeyDown
_image = _codecs.Load("E:\program files\Lead technologies\Images\image3.dcm")
_medicalViewer.Cells.Add(New MedicalViewerCell(_image, True, 1, 1))
_medicalViewer.Cells(0).SetTag(2, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.UserData, "EX. ID 230-36-5448")
_medicalViewer.Cells(0).SetTag(4, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Frame)
_medicalViewer.Cells(0).SetTag(6, MedicalViewerTagAlignment.TopLeft, MedicalViewerTagType.Scale)
_medicalViewer.Cells(0).SetTag(2, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.WindowLevelData)
_medicalViewer.Cells(0).SetTag(1, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.FieldOfView)
_medicalViewer.Cells(0).SetTag(1, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "Good, Guy")
_medicalViewer.Cells(0).SetTag(2, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "PID 125-98-445")
_medicalViewer.Cells(0).SetTag(3, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "DOB 08/02/1929")
_medicalViewer.Cells(0).SetTag(5, MedicalViewerTagAlignment.TopRight, MedicalViewerTagType.UserData, "03/16/1999")
_medicalViewer.Cells(0).SetTag(0, MedicalViewerTagAlignment.BottomLeft, MedicalViewerTagType.RulerUnit)
_medicalViewer.Cells(0).SetTag(0, MedicalViewerTagAlignment.BottomRight, MedicalViewerTagType.OwnerDraw)
RasterCodecs.Shutdown()
Controls.Add(_medicalViewer)
End Sub
End Class |