Crystal Reports/VB - Resize in Preview Window? 
Author Message
 Crystal Reports/VB - Resize in Preview Window?

I'm displaying a Crystal Report within a child window, but I can't get it to
resize with the window.

The following code activates the report within a child form (frmPrev) window.

    Set rpt = mdiMain!rptClosing
    rpt.Destination = outputdest

    rpt.DataFiles(0) = tempfile 'AppDir + "test.lmk"
    rpt.ReportFileName = AppDir + "closing.rpt"

    If outputdest = 0 Then
        frmPrev.Show
        mdiMain!rptClosing.WindowParentHandle = frmPrev.hWnd
    End If

    mdiMain!rptClosing.Action = 1

In the resize event of the frmPrev form is the following code:

    Set rpt = mdiMain!rptClosing

    rpt.WindowLeft = 0
    rpt.WindowTop = 0
    rpt.WindowHeight = frmPrev.ScaleHeight
    rpt.WindowWidth = frmPrev.ScaleWidth

When I resize the frmPrev window, the report doesn't resize with the form.  
Please help.

-Rich W.



Tue, 14 Dec 1999 03:00:00 GMT  
 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



Thu, 23 Dec 1999 03:00:00 GMT  
 Crystal Reports/VB - Resize in Preview Window?

One thing I forgot to state was the form's ScaleMode is set to 3 -
Pixel, so not to have to convert for the api calls.

         Alan Davis, Southampton, England



Thu, 23 Dec 1999 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Crystal Reports/VB print preview resize in window?

2. Resizing Preview Window in Crystal Reports / VB4

3. VB 4.0 (16-Bit)/Crystal Reports 3.0.1.32 (16-Bit) Print Preview Maximize Window

4. Crontrolling the Crystal Report Preview Window from a VB Toolbar

5. Is there a preview window for Crystal Reports integrated into VB.Net

6. Crontrolling the Crystal Report Preview Window from a VB Toolbar

7. Closing Crystal Reports Preview Window

8. Preview Crystal Report to window follow by export to file encountered ‘a

9. Problems with Crystal Reports preview window

10. Previewing without Crystal Report's Window

11. Crystal Reports not resizing in window

12. Crystal Reports not resizing in window

 

 
Powered by phpBB® Forum Software