成人午夜激情影院,小视频免费在线观看,国产精品夜夜嗨,欧美日韩精品一区二区在线播放

[紅]Visual Basic中實(shí)現(xiàn)帶預(yù)覽的對(duì)話框

2010-08-28 10:49:27來源:西部e網(wǎng)作者:

    用戶在圖片框中選擇圖片時(shí),希望預(yù)先對(duì)圖片的輪廓及大小有初步了解,但是VB的通用對(duì)話框沒有預(yù)覽的功能,為此需要定制一個(gè)自定義對(duì)話框。我們可以通過image控件加入窗體中來實(shí)現(xiàn)其功能。

   程序示例:

   程序功能說明:

   在窗體的file1中選擇一個(gè)圖片文件,點(diǎn)選“預(yù)覽”復(fù)選框,image控件就顯示相應(yīng)的圖片,label1就顯示該圖片的大小。

   新建一個(gè)工程,加入以下控件:

   控件 名稱 屬性
   form form1 borderstyle=3
   (vbsizedouble)
   caption=“圖片預(yù)覽對(duì)話框"
   drivelistbox drive1
   dirlistbox dir1
   filelistbox file1 pattern=“*.bmp;
   *.jpg;*.gif"
   image image1 stretch=true
   checkbox chk value=“預(yù)覽"
   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
關(guān)鍵詞:VisualBasic

贊助商鏈接:

主站蜘蛛池模板: 丹凤县| 沙洋县| 荥阳市| 色达县| 府谷县| 乡宁县| 竹山县| 滕州市| 贡觉县| 萨迦县| 平原县| 寻乌县| 宿松县| 昭觉县| 玉树县| 双流县| 永济市| 永善县| 台南市| 年辖:市辖区| 泸溪县| 绥中县| 双桥区| 崇文区| 黑龙江省| 靖西县| 区。| 怀来县| 宜兰市| 东乡| 九寨沟县| 莆田市| 子洲县| 江山市| 昭通市| 安福县| 安岳县| 金平| 鸡东县| 宜宾县| 大化|