Home » Category » Microsoft Visual Basic

Microsoft Visual Basic: zoom In / out

112| Sat, 10 Nov 2007 23:13:00 GMT| anonymous| Comments (2)
[Originally posted by Nikhil]

Hi ,

I am developing an application where I want certain part of my window to be zoomed in / out (including percentage of zooming).
The application should work same after zooming in / out. (For. eg. Although the screen is zoomed in, the scrolling should be provided)
How do i do this.
Can i use windows API for this ? If yes , which one ?
Plz help me , it's very urgent.

Nikhil.

Keywords & Tags: zoom, out, microsoft, visual basic, vb

URL: http://www.programmerbase.com/visual-basic/560731/
 
«« Prev - Next »» 2 helpful answers below.
[Originally posted by Robert]

This is an old program for VB3.

'in .bas ********************************

Type pointapi
xcur As Integer
ycur As Integer
End Type

Declare Function StretchBlt% Lib "GDI" (ByVal hDC%, ByVal X%, ByVal Y%, ByVal nWidth%, ByVal nHeight%, ByVal hSrcDC%, ByVal XSrc%, ByVal YSrc%, ByVal nSrcWidth%, ByVal nSrcHeight%, ByVal dwRop&)
Declare Sub GetCursorPos Lib "User" (lpPoint As pointapi)
Declare Function GetDesktopWindow Lib "User" () As Integer
Declare Function GetDC Lib "User" (ByVal hWnd As Integer) As Integer
Declare Function ReleaseDC Lib "User" (ByVal hWnd As Integer, ByVal hDC As Integer) As Integer

Global lppoints As pointapi

'************************************

Put label1, picture1, spin1, GroupPush3D1.
When you press GroupPush3D1 picture in picture1 will be zoomed.

'in form1 **********************************
'+++++++++++++++++++++++++++++++
'put in form1 declaration section
declaration
Dim xold%, yold%
'+++++++++++++++++++++++++++++++

Sub Timer1_Timer ()

If GroupPush3D1.Value = 0 Then Exit Sub

duz = Val(label1.Caption)

GetCursorPos lppoints
If lppoints.xcur <> xold% Or lppoints.ycur <> yols% Then
hwndsrc% = GetDesktopWindow()
hsrcdc% = GetDC(hwndsrc%)
a% = StretchBlt(form1.Picture1.hDC, 0, 0, form1.Picture1.ScaleWidth, form1.Picture1.ScaleHeight, hsrcdc%, lppoints.xcur - duz / 2, lppoints.ycur - duz / 2, duz, duz, &HCC0020)

' a% = StretchBlt(form1.hDC, 0, 0, form1.ScaleWidth, form1.ScaleHeight, hsrcdc%, lppoints.xcur - 50, lppoints.ycur - 50, 100, 100, &HCC0020)

b% = ReleaseDC(hwndsrc%, hsrcdc%)
xold% = lppoints.xcur
yold% = lppoints.ycur
End If
End Sub

Sub Form_Load ()
xold% = 0
yold% = 0
' picture1.visible = False
label1.Caption = 100
End Sub

Sub Spin1_SpinDown ()
label1.Caption = Val(label1.Caption) - 1
label1.Refresh
End Sub

Sub Spin1_SpinUp ()
label1.Caption = Val(label1.Caption) + 1
label1.Refresh
End Sub

Sub GroupPush3D1_Click (Value As Integer)
' Print Value
End Sub
'******************************************

anonymous | Sun, 11 Nov 2007 19:08:00 GMT |

[Originally posted by Nikhil]

Hi

Thanx for ur reply,
But .. I m getting an error of Overflow in StretchBlt function , i don't know for what ?
i guess it's not due to VB 3.0 version conflict, because I am using VB 6.0.

Plz help
Thanx again

anonymous | Sun, 11 Nov 2007 19:09:00 GMT |

Microsoft Visual Basic Hot Answers

Microsoft Visual Basic New questions

Microsoft Visual Basic Related Categories