Setting PrintPreviewControl.Zoom does not update toolbar menu

  • Thread starter Thread starter Bruce Wood
  • Start date Start date
B

Bruce Wood

Has anyone else encountered this? I've been battling with it now for a
couple of weeks off and on.

If you try to bring up a PrintPreview dialog with an explicit zoom
factor set, you can do it like this:

Me.PrintPreviewControl.Zoom = 5.0

This will force AutoZoom to False, which is what I would expect.

The form comes up zoomed to 500%, as expected, but the
magnifying-glass toolbar menu still as "Auto" checked. Re-selecting
Auto causes the display to auto zoom. Selecting 500% causes the
display to remain unchanged but now the correct magnification is
checked in the menu.

On top of all of this, the "200%" menu setting is really 250% (it sets
Zoom to 2.5, not 2.0).

I have had this toolbar zoom menu do all sorts of strange things over
the past couple of weeks, from always showing "Auto" selected (as it
is doing now) to selecting the correct zoom factor, but not selecting
"Auto" when AutoZoom is True, to... well, I can't remember all the
combinations.

Has anyone else had trouble with this?
 
Hi,


Today I dealt with the same problem, fortunately I found a workaround about this issue.

You have to walk through the array of controls of the PrintPreviewDialog.
Next piece of code set the zoom property to 100% and check the '100%' menuitem of the PrintPreviewDialog zoom toolbarbutton:

'Zoom document 100%

innerPrintPreview.PrintPreviewControl.Zoom = 1.0

'Check 100% zoom Toolbarbutton menu item. 'Auto zoom' menu item unchecked.

If innerPrintPreview.Controls.Count > 1 AndAlso (TypeOf innerPrintPreview.Controls(1) Is System.Windows.Forms.ToolBar) Then

IfCType(innerPrintPreview.Controls(1), System.Windows.Forms.ToolBar).Buttons.Count > 1 Then

Dim tb As System.Windows.Forms.ToolBarButton = CType(innerPrintPreview.Controls(1), System.Windows.Forms.ToolBar).Buttons(1)

If tb.DropDownMenu.MenuItems.Count > 4 Then

tb.DropDownMenu.MenuItems.Item(0).Checked = False

tb.DropDownMenu.MenuItems.Item(4).Checked = True

EndIf

EndIf

EndIf

Notes:
1. innerPrintPreview is a PrintPreviewDialog.

I hope this fix you problem.

Olman Q.
 
Back
Top