' Form1.frm
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB} #1.2#0"; "COMDLG32. OCX "
Begin VB. Form Form1
Caption = "Form1"
ClientHeight = 5010
ClientLeft = 60
ClientTop = 345
ClientWidth = 7800
LinkTopic = "Form1"
ScaleHeight = 334
ScaleMode = 3 ' Pixel
ScaleWidth = 520
startupposition = 3 ' window defaults
Begin Mscomdlg.commondialog CommonDialog1
left = 4635
top = 3120
_extentx = 847
_extenty = 847
_version = 393216
End
Begin VB. Frame Frame1
Caption = "Frame1"
Height = 3000
left = 4500
TabIndex = 2
top = 30
Width = 3180
Begin VB. PictureBox Picture2
Appearance = 0 ' Flat
ForeColor = &H80000008&
Height = 2625
left = 120
ScaleHeight = 173
ScaleMode = 3 ' Pixel
ScaleWidth = 194
TabIndex = 3
top = 255
Width = 2940
Begin VB. Image Image1
Height = 1575
left = 465
top = 390
Width = 1965
End
End
End
Begin Vb.commandbutton Command1
Caption = "&load picture"
Height = 330
left = 5400
TabIndex = 0
top = 3150
Width = 1425
End
Begin VB. PictureBox Picture1
Appearance = 0 ' Flat
AutoSize =-1 ' True
BorderStyle = 0 ' None
ForeColor = &H80000008&
Height = 4425
left = 60
ScaleHeight = 4425
ScaleWidth = 4380
TabIndex = 1
top = 105
Width = 4380
End
End
Attribute vb_name = "Form1"
Attribute Vb_globalnamespace = False
Attribute vb_creatable = False
Attribute Vb_predeclaredid = True
Attribute vb_exposed = False
Option Explicit
Dim Returnheight as Long, returnwidth as Long
Private Sub Command1_Click ()
Dim Bigwidth as Long, bigheight as Long
Dim Stretchwidth as Long, stretchheight as Long
Commondialog1.filter = "JPEG file |*.jpg|gif file |*.gif| all Files |*.*"
Commondialog1.showopen
If commondialog1.filename <> "" Then
Picture1.Picture = LoadPicture (commondialog1.filename)
Image1.left = (picture2.scalewidth-image1.width)/2
Image1.top = (picture2.scaleheight-image1.height)/2
Image1.picture = LoadPicture (commondialog1.filename)
End If
End Sub
Private Sub stretchimage (originalwidth as Long, originalheight as long, stretchwidth as long, stretchheight as Long, optio Nal Flag as Boolean = False)
If (originalwidth >= stretchwidth or OriginalHeight > stretchheight) Or Flag = True Then ' needs scaling
If originalwidth/originalheight >= stretchwidth/stretchheight Then
Returnwidth = Stretchwidth
Returnheight = Stretchwidth/originalwidth * originalheight
Else
Returnheight = Stretchheight
Returnwidth = Stretchheight/originalheight * originalwidth
End If
Else
Returnheight = OriginalHeight
Returnwidth = OriginalWidth
End If
End Sub
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.