S
Steve
Hi...
I'm trying to visually center a merged word document that was created using
word automation in vb.net, within the boundaries of a vb.net form that is
centered on the screen and was used to trigger the automation. Once
displayed the user can maximize, minimize or modify the size of the window
to their hearts content.
The code below appears to work on my development box when centering and
sizing a word application in front of the form that triggered the
automation. But on the target boxes, it skews down and to the right. And
the size of the word window on the target machine is dispalyed bigger than
the form window that I'm calculating against. The word window should be .9
as wide and .8 as high as the form window).
My thought is that has something to do with the target box resolution or
font size which is different than the development box.
Any assistance that can be provided is appreciated.
Steve
WordApp.Visible = True
WordApp.ActiveWindow.WindowState = Word.WdWindowState.wdWindowStateNormal
WordApp.ActiveWindow.View.Zoom.Percentage = 75
WordApp.Resize(WordApp.PixelsToPoints(Int(0.9 * Me.Width), False),
WordApp.PixelsToPoints(Int(0.8 * Me.Height), True))
WordApp.Move(WordApp.PixelsToPoints(Me.Left, False) +
((WordApp.PixelsToPoints(Me.Width, False) - WordApp.Width) / 2), _
WordApp.PixelsToPoints(Me.Top, True) +
((WordApp.PixelsToPoints(Me.Height, True) - WordApp.Height) / 2))
I'm trying to visually center a merged word document that was created using
word automation in vb.net, within the boundaries of a vb.net form that is
centered on the screen and was used to trigger the automation. Once
displayed the user can maximize, minimize or modify the size of the window
to their hearts content.
The code below appears to work on my development box when centering and
sizing a word application in front of the form that triggered the
automation. But on the target boxes, it skews down and to the right. And
the size of the word window on the target machine is dispalyed bigger than
the form window that I'm calculating against. The word window should be .9
as wide and .8 as high as the form window).
My thought is that has something to do with the target box resolution or
font size which is different than the development box.
Any assistance that can be provided is appreciated.
Steve
WordApp.Visible = True
WordApp.ActiveWindow.WindowState = Word.WdWindowState.wdWindowStateNormal
WordApp.ActiveWindow.View.Zoom.Percentage = 75
WordApp.Resize(WordApp.PixelsToPoints(Int(0.9 * Me.Width), False),
WordApp.PixelsToPoints(Int(0.8 * Me.Height), True))
WordApp.Move(WordApp.PixelsToPoints(Me.Left, False) +
((WordApp.PixelsToPoints(Me.Width, False) - WordApp.Width) / 2), _
WordApp.PixelsToPoints(Me.Top, True) +
((WordApp.PixelsToPoints(Me.Height, True) - WordApp.Height) / 2))