Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PictueBox enlargment and scrolling

Status
Not open for further replies.

domt

Programmer
Mar 13, 2001
115
US
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
 
you may find thread222-439822 helpful

good luck If somethings hard to do, its not worth doing - Homer Simpson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top