The form i am hosting the crystal report in is a maximzed window. how i get the report to be all it can be. err be maximzed also.
Printable View
The form i am hosting the crystal report in is a maximzed window. how i get the report to be all it can be. err be maximzed also.
In the Resize event of the Form resize the Crystal Viewer control.
The following causes the control to fill the entire client area of the form. If you have any other controls on the form you will need to adjust accordingly.
VB Code:
Private Sub Form_Resize() rptViewer.Move 0, 0, ScaleWidth, ScaleHeight End Sub
it says scalewidth isnt declared. is there somethiung i need to import?
Where did you put this code?
ScaleWidth and ScaleHeight are properties of a Form.
the report loads with form
the report loads with form. it would be the only code i put in for that form. kinda just sitting byitself.
Please post your form file.
there isnt a point to it. it is bare. all that is on there is the crystal viewer.
The code I posted for the Resize event should work in every single form for any kind of control.
Are you using VB 6.0 or .NET or ?????
vb.net 2003
in the form resize event i changed
toVB Code:
rptViewer.Move 0, 0, ScaleWidth, ScaleHeight
now it is also maximized, but if i minimize or maximize the window from there the report doesnt show up. is this the wrong way to go or is ther eextyra code i need to add?VB Code:
rptViewer.scale(100,100)
ok it turns out that scale variables are integer ratios. i changed 100 to 1 for 100%. now it can maximize and minimize without probems, but i still want the viewer to size itself to how big the window is.
I don't use .NET that much yet but I do know each control has a Dock property. Set the Dock property equal to Fill from within the properties window or use the following in the Form's Load event.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
rptViewer.Dock = DockStyle.Fill
End Sub
brilliant! Kudos.