|
-
Aug 22nd, 2002, 09:07 AM
#1
Thread Starter
New Member
Picturebox ReSize or Cut
I have a problem with my picturebox. I draw alot of lines and data in it and everything works fine.
From the beginning the size of the picturebox is 600x600 and it has to be. When I have finished drawin in it, I need to "Cut" the picture down to 600x300, In other words cut the bottom half out. I do this because sometimes it's no data there, and when I save the picture with the SavePicture function, the picture will be half the size if I cut it down to 600x300 instead of 600x600.
Here is the problem: When I change the height of the picture to 300 and then save it, it will still be the same size(600x600) with the same unnecessary space in the picture.
In short : I want to "Cut off" the bottom half of a picture in a picturebox....how do I do this .. ??
-
Aug 22nd, 2002, 09:42 AM
#2
-
Aug 22nd, 2002, 09:55 AM
#3
Here you go, I've rewritten it in Engliish or you could say I've cropped the code for you 
To see this in action, create a new app & shove 2 pictureboxes & 1 command button on a form.
VB Code:
Private Sub Command1_Click()
Dim XUpperLeft As Long
Dim YUpperLeft As Long
Dim XLowerRight As Long
Dim YLowerRight As Long
XUpperLeft = Picture1.Left
YUpperLeft = Picture1.Top
XLowerRight = 2000
YLowerRight = 2000
With picture2
.Picture = LoadPicture()
.Cls
DoEvents
.PaintPicture Picture1.Picture, 0, 0, (XLowerRight - XUpperLeft), _
(YLowerRight - YUpperLeft), XUpperLeft, YUpperLeft, _
(XLowerRight - XUpperLeft), (YLowerRight - YUpperLeft)
DoEvents
End With
End Sub
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
|