Óû§ÔÚͼƬ¿òÖÐÑ¡ÔñͼƬʱ£¬Ï£ÍûÔ¤ÏȶÔͼƬµÄÂÖÀª¼°´óСÓгõ²½Á˽⣬µ«ÊÇVBµÄͨÓöԻ°¿òûÓÐÔ¤ÀÀµÄ¹¦ÄÜ£¬Îª´ËÐèÒª¶¨ÖÆÒ»¸ö×Ô¶¨Òå¶Ô»°¿ò£¬
Visual BasicÖÐʵÏÖ´øÔ¤ÀÀµÄ¶Ô»°¿ò
¡£ÎÒÃÇ¿ÉÒÔͨ¹ýimage¿Ø¼þ¼ÓÈë´°ÌåÖÐÀ´ÊµÏÖÆ书ÄÜ¡£³ÌÐòʾÀý£º
³ÌÐò¹¦ÄÜ˵Ã÷£º
ÔÚ´°ÌåµÄfile1ÖÐÑ¡ÔñÒ»¸öͼƬÎļþ£¬µãÑ¡“Ô¤ÀÀ”¸´Ñ¡¿ò£¬image¿Ø¼þ¾ÍÏÔʾÏàÓ¦µÄͼƬ£¬label1¾ÍÏÔʾ¸ÃͼƬµÄ´óС¡£
н¨Ò»¸ö¹¤³Ì£¬¼ÓÈëÒÔÏ¿ؼþ£º
¿Ø¼þ Ãû³Æ ÊôÐÔ
form. form1 borderstyle=3
(vbsizedouble)
caption=“ͼƬԤÀÀ¶Ô»°¿ò"
drivelistbox drive1
dirlistbox dir1
filelistbox file1 pattern=“£ª.bmp;
£ª.jpg;£ª.gif"
image image1 stretch=true
checkbox chk value=“Ô¤ÀÀ"
commandbutton cmd1 caption=“È·¶¨"
cmd2 caption=“Í˳ö"
label lab1 caption=“"
Ô´´úÂ룺
'declare
Public filename¡ç
dim sfilename¡ç
Private sub drive1_change()
dir1.path=drive1.drive
End sub
Private sub dir1_change()
file1.path=dir1.path
End sub
Private sub cmd1_click()
filename=sfilename
End sub
Private sub cmd2_click()
End
End sub
Private sub file1_click()
dim ssize as long
if fille1.listcount>0 then
if right(file1.path,1)<>“\" then
sfilename=file1.path£¦“\"£¦file1.filename
else
sfilename=file1.path£¦file1.filename
End if
if chk.checked then
image1.picture=loadpicture(“")
image1.picture=loadpicture(sfilename)
ssize=filelen(sfilename)
ssize=ssize/1000
lab1.caption=str(ssize)£¦“k"
else
lab1.caption=“"
image1.picture=loadpicture(“")
end if
end if
End sub