Hello,

I'm developing an OCX and I'm in trouble of how
to draw the focus on the first control when the form
loads (the control with the TabIndex=0).
The focus jumps from one control to another correctly.
Only the focus of the first control of the form isn't being showed correctly.


This is my code:

Private Sub UserControl_EnterFocus()
UserControl.ScaleMode = 3
lpRect.Top = 3
lpRect.Left = 3
lpRect.Right = (UserControl.Width \ Screen.TwipsPerPixelX) - 3
lpRect.Bottom = (UserControl.Height \ Screen.TwipsPerPixelY) - 3

DrawFocusRect UserControl.hdc, lpRect
UserControl.ScaleMode = 1
End Sub


Private Sub UserControl_ExitFocus()
UserControl.ScaleMode = 3
lpRect.Top = 3
lpRect.Left = 3
lpRect.Right = (UserControl.Width \ Screen.TwipsPerPixelX) - 3
lpRect.Bottom = (UserControl.Height \ Screen.TwipsPerPixelY) - 3

DrawFocusRect UserControl.hdc, lpRect
UserControl.ScaleMode = 1
End Sub

Is there any special tip to show the focus correctly?

Thanks for any help.

Michel Jr.