
Crystal Reports/VB - Resize in Preview Window?
Hello Rich,
I don't know whether this helps or not.
This is what I do using Visual Basic 4.0 pro 32 bit and Crystal
Reports 5.0 pro.
1) In a module's declaration section, place these statements
Declare Function SetFocusAPI Lib "user32" Alias "SetFocus" (ByVal hwnd
As Long) As Long
Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal X
As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long,
ByVal bRepaint As Long) As Long
Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal
wCmd As Long) As Long
Public Const GW_CHILD = 5
2) Place a picture box on your form.
3) In the form load ( or wherever ), set the your report control's
WindowParentHandle property to equal that of the the picture box's
handle.
4) In the form's resize event insert this code
Private Sub Form_Resize()
With picture1
.Align = vbAlignTop
.Align = vbAlignLeft
Call MoveWindow(GetWindow(.hwnd, GW_CHILD), 0, 0, .Width,
Height, 1)
End With
End Sub
5) In the picture box's Got_Focus event, place this window
Private Sub picture1_GotFocus()
Call SetFocusAPI(GetWindow(picture1.hwnd, GW_CHILD))
End Sub
Hope this helps
Alan Davis, Southampton, England