MagGlassOwnerDraw Example for Visual Basic
Dim RasterAnn As LEADRasterAnnotation
Dim RasterIO As LEADRasterIO
Dim hObject As Long
Private Sub Form_Load()
Dim Raster As New LEADRaster
Set RasterAnn = New LEADRasterAnnotation
Set RasterIO = New LEADRasterIO
RasterIO.Load Me.LEADRasterView1.Raster, App.Path & "\image.jpg", 0, 0, 1
RasterAnn.AnnParentRasterView = Me.LEADRasterView1
RasterAnn.AnnUserMode = ANN_USERMODE_DESIGN
RasterAnn.AnnCreate ANN_OBJECT_BUTTON, True, True
hObject = RasterAnn.AnnObject
RasterAnn.AnnRectHeight(hObject) = 100
RasterAnn.AnnRectWidth(hObject) = 200
RasterAnn.AnnRectLeft(hObject) = 50
RasterAnn.AnnRectTop(hObject) = 50
RasterAnn.AnnSetFontName hObject, "", False
RasterAnn.AnnSetText hObject, "Lead Tools", False
End Sub
Private Sub LEADRasterView1_MagGlassOwnerDraw(ByVal hWnd As Long, ByVal hMemDC As Long, ByVal lXPos As Long, ByVal lYPos As Long, ByVal lMagGlassTop As Long, ByVal lMagGlassLeft As Long, ByVal lMagGlassBottom As Long, ByVal lMagGlassRight As Long)
RasterAnn.AnnMagGlass hMemDC, lXPos, lYPos, 200, 200, 200
End Sub
Private Sub StopMagGlass_Click()
LEADRasterView1.StopMagGlass
LEADRasterView1.EnableMagGlassDraw = False
RasterAnn.AnnEnableMagGlass = False
End Sub
Dim RasterIO As New LEADRasterIO
Private Sub Command1_Click()
RasterIO.Load Me.LEADRasterView1.Raster, App.Path & "\image.jpg", 0, 0, 1
MsgBox LEADRasterView1.Raster.BitmapBytesPerLine
End Sub
Private Sub StartMagGlass_Click()
LEADRasterView1.EnableMagGlassDraw = True
RasterAnn.AnnEnableMagGlass = True
LEADRasterView1.StartMagGlass 200, 200, 200, RGB(0, 0, 0), _
RGB(255, 255, 255), False, 1, _
False, CROSSHAIR_FINE, False, False
End Sub