|
-
Jul 16th, 2000, 04:09 PM
#1
Thread Starter
Lively Member
First, I'd suggest the image control instead of the picture box.
1) Put a frame with no border on your form.
2) Place an image inside the frame.
3) Set the imagecontrols "stretch" property to TRUE.
3) When the user clicks the button, enlarage the imagecontrol, and set it's "top" and "left" properties so it shows the correct part of the picture.
Should work...
//Anders
-
Jul 16th, 2000, 04:34 PM
#2
Use PaintPicture
If you want to keep the PictureBox, use the PaintPicture method for the Zooming. For this, you need to create 2 PictureBoxes. Load your Picture into Picture2.
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
'Make the Picture twice as large
If KeyCode = vbKeyAdd Then
With Picture1
.Cls
.Width = .Width * 2
.Height = .Height * 2
.PaintPicture Picture2.Picture, 0, 0, .ScaleWidth, .ScaleHeight
End With
End If
'Make the Picture twice as small
If KeyCode = vbKeySubtract Then
With Picture1
.Cls
.Width = .Width / 2
.Height = .Height / 2
.PaintPicture Picture2.Picture, 0, 0, .ScaleWidth, .ScaleHeight
End With
End If
'Center the PictureBox
Picture1.Move (Me.ScaleWidth / 2) - (Picture1.Width / 2), (Me.ScaleHeight / 2) - (Picture1.Width / 2)
End Sub
Private Sub Form_Load()
'Make Picture2 invisible
Picture2.Visible = False
'Make the Form recieve Key events before Controls
Me.KeyPreview = True
'ReDraw the Picture so it doesn't get cut off
Picture1.AutoRedraw = True
'Draw the Picture on to Picture1
Picture1.PaintPicture Picture2.Picture, 0, 0
End Sub
When you press Add or Subtract, it will Zoom in and Zoom out.
-
Jul 17th, 2000, 12:13 PM
#3
Frenzied Member
k, thanks guys, i think i will keep the picture box and use Megatron's way, but thanks to Anders Englund too. !!! :P
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|