Is there any way in vb that when I scroll over a picture box or click on a picure box, that it would 'blow up' to a bigger image and go back to the original size once you scroll off of the picture or reclick :ehh: ?
Printable View
Is there any way in vb that when I scroll over a picture box or click on a picure box, that it would 'blow up' to a bigger image and go back to the original size once you scroll off of the picture or reclick :ehh: ?
StretchBlt is what you want:
Use it like this:VB Code:
Private Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long Private Const SRCAND = &H8800C6 ' (DWORD) dest = source AND dest Private Const SRCCOPY = &HCC0020 ' (DWORD) dest = source Private Const SRCINVERT = &H660046 ' (DWORD) dest = source XOR dest Private Const SRCPAINT = &HEE0086 ' (DWORD) dest = source OR dest Function StretchPic(picBox As PictureBox, times As Integer) As Long StretchBlt picBox.hdc, 0, 0, picBox.ScaleWidth * times, picBox.ScaleHeight * times, picBox.hdc, 0, 0, picBox.ScaleWidth, picBox.ScaleHeight, SRCCOPY End Function
Hope that helps :)VB Code:
StretchPic PictureBox, 2 '2 for 2 times the size..
chem
Hi vbzoom and welcome to VBF! :wave:
Here is a small procedure that allows to zoom in/out image but KIM that the higher the resolution the more distorted it would get:
VB Code:
Public Sub ZoomPicture(pct As PictureBox, zoom As Double) With pct .Width = .Width * zoom .Height = .Height * zoom .PaintPicture .Picture, 0, 0, .ScaleWidth, .ScaleHeight End With End Sub 'usage: Private Sub Command1_Click() '============================ 'zoom it out ZoomPicture Picture1, 0.9 End Sub Private Sub Command2_Click() '============================ 'zoom it in ZoomPicture Picture1, 1.1 End Sub
Alright thanks....you guys helped out a lot.