|
-
Jul 22nd, 2005, 06:22 AM
#1
Thread Starter
Member
Last edited by Pino; Jul 22nd, 2005 at 06:55 AM.
-
Jul 22nd, 2005, 07:13 AM
#2
Addicted Member
Re: Resize image proportionally?
add an invisible Picture box to your form and fill the image in this form.
Then, using BitBlt, transform the image from the invisble picture box to your Open picture box
-
Jul 22nd, 2005, 07:15 AM
#3
Addicted Member
Re: Resize image proportionally?
Sorry, forgot to mention, BitBlt is an Win32 API function.
Public Declare Function BitBlt Lib "gdi32.dll" ( _
ByVal hDestDC 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 dwRop As Long) As Long
-
Jul 22nd, 2005, 06:30 PM
#4
Thread Starter
Member
Re: Resize image proportionally?
So how exactly do I put that into the above code? (I'm a bit of a noob at VB)
-
Jul 22nd, 2005, 08:55 PM
#5
Thread Starter
Member
Re: Resize image proportionally?
Is that the simplest way (the bitblt thing) while still being reasonably fast? ... still not sure how to use it though, any help?
-
Jul 22nd, 2005, 10:48 PM
#6
Thread Starter
Member
Re: Resize image proportionally?
Just used a simple thing:
VB Code:
Private Sub File1_Click()
If Right(File1.Path, 1) <> "\" Then
txtPath.Text = File1.Path & "\" & File1.FileName
Else 'If root directory
txtPath.Text = File1.Path & File1.FileName
End If
On Error GoTo handleit
frmPhoto.Open.Stretch = False
frmPhoto.Open.Picture = LoadPicture(txtPath.Text)
If frmPhoto.Open.Height >= 4875 Or frmPhoto.Open.Width >= 7600 Then
Do While frmPhoto.Open.Height >= 4875 Or frmPhoto.Open.Width >= 7600
frmPhoto.Open.Height = frmPhoto.Open.Height * 0.95
frmPhoto.Open.Width = frmPhoto.Open.Width * 0.95
Loop
frmPhoto.Open.Stretch = True
End If
frmPhoto.Open.Left = (Frame1.Width - frmPhoto.Open.Width) \ 2
frmPhoto.Open.Top = (Frame1.Height - frmPhoto.Open.Height) \ 2
handleit:
Exit Sub
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
|