I'm modifying an existing program in VB6 but have no clue on how to work with the Lead control (from LeadTools, a 3rd party tool) that also works with another 3rd party for drawing (cresent controls, like CSinv).

The client wants the whole lead control to "save" the drawing/typing the user enters/draws.

The current problem is that only partially is saved and I cannot understand or figure out how to fix this. The user is able to draw in the whole box, but if the window is inactive or repainted, only partially is shown and the rest is gone. But typing in text will not go all the way across the control.

Those APIs and codes are foregin to me.

Any help would be appreicated!

Here's the code in MouseUp, MouseDown, MouseMove:

Private Sub Lead1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
DrawNow = False
mlReturn = SelectObject(LeadBitmapDC, hOldPen)
hOldPen = DeleteObject(MyPen)
Lead1.ReleaseBitmapDC '

mlReturn = SelectObject(LeadClientDC, hOldPenClient)
hOldPenClient = DeleteObject(MyPenClient)

End Sub

Private Sub Lead1_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error Resume Next
Dim StartX As Single
Dim StartY As Single
Dim hOldBitmapBrush As Long

'If frmNotes.chkModify.Enabled = False Then invPenColor_Click (0)
DrawNow = True
Lead1.ScaleMode = 3
If Lead1.Bitmap <> 0 Then
ZoomFactorX = Lead1.DstWidth / Lead1.SrcWidth
ZoomFactorY = Lead1.DstHeight / Lead1.SrcHeight
End If

StartX = x / Screen.TwipsPerPixelX
StartY = y / Screen.TwipsPerPixelY

BStartX = (StartX / ZoomFactorX) - (Lead1.DstLeft / ZoomFactorX) + Lead1.SrcLeft
BStartY = (StartY / ZoomFactorY) - (Lead1.DstTop / ZoomFactorY) + Lead1.SrcTop '

LeadBitmapDC = Lead1.GetBitmapDC
MyPen = CreatePen(PS_SOLID, penWidth, penColor)
hOldBitmapBrush = SelectObject(LeadBitmapDC, GetStockObject(HOLLOW_BRUSH))
'MyBrush = CreateSolidBrush(RGB(0, 255, 0))
hOldPen = SelectObject(LeadBitmapDC, MyPen)
'hOldBrush = SelectObject(LeadDC, MyBrush)
hOldDrawMode = SetROP2(LeadBitmapDC, penDrawMode) 'use R2_MASKPEN for annotations
'use R2_COPYPEN for solid inking
LeadClientDC = Lead1.GetClientDC
MyPenClient = CreatePen(PS_SOLID, penWidth, penColor)
hOldPenClient = SelectObject(LeadClientDC, MyPenClient)
hOldDrawModeClient = SetROP2(LeadClientDC, penDrawMode) 'use R2_MASKPEN for annotations
'use R2_COPYPEN for solid inking

End Sub

Private Sub Lead1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error Resume Next
Dim EndX As Single
Dim EndY As Single

If DrawNow Then
EndX = x / Screen.TwipsPerPixelX
EndY = y / Screen.TwipsPerPixelY

BEndX = (EndX / ZoomFactorX) - (Lead1.DstLeft / ZoomFactorX) + Lead1.SrcLeft
BEndY = (EndY / ZoomFactorY) - (Lead1.DstTop / ZoomFactorY) + Lead1.SrcTop

MyPoint.x = 0
MyPoint.y = 0

'remember to ADD the offset for the amount that the Lead controls picture
'is scrolled horizontally and vertically to make the drawing appear in the
'same place on the LeadClientDC as on the LeadBitmapDC itself!
mlReturn = MoveToEx(LeadBitmapDC, BStartX, BStartY, MyPoint)
mlReturn = MoveToEx(LeadClientDC, BStartX + Lead1.DstLeft, BStartY + Lead1.DstTop, MyPoint)
mlReturn = LineTo(LeadBitmapDC, BEndX, BEndY)
mlReturn = LineTo(LeadClientDC, BEndX + Lead1.DstLeft, BEndY + Lead1.DstTop)


BStartX = BEndX
BStartY = BEndY
End If

End Sub