I have a form with a large PictureBox, pct_dest, which is visible, a second PictureBox, pct_src, with Visibility = False, and a scroll bar.
The scroll bar in the following code enlarges the picture in pct_dest.
Although the picture in pct_src is fixed at design time in this version, I'll change that later so that the user can bring a picture in.
***************************************************
Public ZoomFactor As Double
Private Sub resize()
pct_dest.Cls
pct_dest.PaintPicture pct_src.Picture, 0, 0, pct_dest.ScaleWidth, pct_dest.ScaleHeight, _
0, 0, pct_src.ScaleWidth * ZoomFactor, pct_src.ScaleHeight * ZoomFactor, vbSrcCopy
End Sub
Private Sub Form_Load()
HScroll1.Max = 32767
HScroll1.Min = 1
HScroll1.Value = 32767
ZoomFactor = 1
resize
End Sub
Private Sub HScroll1_scroll()
ZoomFactor = 1 + HScroll1.Value / 32767 * 5
resize
End Sub
****************************************************
With a large picture, only the upper left portion of the picture is seen when the picture is enlarged to any extent.
Is there any way I can add horizontal and vertical scroll bars to move any part of an enlarged picture into view?
Any help would be appreciated.
Dom
The scroll bar in the following code enlarges the picture in pct_dest.
Although the picture in pct_src is fixed at design time in this version, I'll change that later so that the user can bring a picture in.
***************************************************
Public ZoomFactor As Double
Private Sub resize()
pct_dest.Cls
pct_dest.PaintPicture pct_src.Picture, 0, 0, pct_dest.ScaleWidth, pct_dest.ScaleHeight, _
0, 0, pct_src.ScaleWidth * ZoomFactor, pct_src.ScaleHeight * ZoomFactor, vbSrcCopy
End Sub
Private Sub Form_Load()
HScroll1.Max = 32767
HScroll1.Min = 1
HScroll1.Value = 32767
ZoomFactor = 1
resize
End Sub
Private Sub HScroll1_scroll()
ZoomFactor = 1 + HScroll1.Value / 32767 * 5
resize
End Sub
****************************************************
With a large picture, only the upper left portion of the picture is seen when the picture is enlarged to any extent.
Is there any way I can add horizontal and vertical scroll bars to move any part of an enlarged picture into view?
Any help would be appreciated.
Dom