• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    瀏覽文件夾中的圖片

    發布: 2007-7-14 20:28 | 作者: 佚名    | 來源: 網絡轉載     | 查看: 11次 | 進入軟件測試論壇討論

    領測軟件測試網 首先要新建一個工程,在Form1中添加dirlistbox控件,drivelistbox控件,filelistbox控件,combobox控件,textbox控件,vscrollbar控件和一個command1控件
    然后在代碼框中輸入以下代碼:

    Option Explicit

    private Declare Function FindFirstFile Lib "kernel32" Alias "FindFirstFileA" (ByVal lpFileName As String, lpFindFileData As WIN32_FIND_DATA) As Long
    private Declare Function FindClose Lib "kernel32" (ByVal hFindFile As Long) As Long
    private Declare Function FindNextFile Lib "kernel32" Alias "FindNextFileA" (ByVal hFindFile As Long, lpFindFileData As WIN32_FIND_DATA) As Long
    private Const MAX_PATH = 260
    private Type FILETIME
            dwLowDateTime As Long
            dwHighDateTime As Long
    End Type
    private Type WIN32_FIND_DATA
            dwFileAttributes As Long
            ftCreationTime As FILETIME
            ftLastAccessTime As FILETIME
            ftLastWriteTime As FILETIME
            nFileSizeHigh As Long
            nFileSizeLow As Long
            dwReserved0 As Long
            dwReserved1 As Long
            cFileName As String * MAX_PATH
            cAlternate As String * 14
    End Type

    Dim Pic As Object
    Private Sub Command1_Click()
    Dim obj As Object
    Dim pcname As String
    Dim i As Long, j As Long, counter As Long
    Dim wfd As WIN32_FIND_DATA
    Dim source As String, piname As String
    Dim hfile As Long
    Dim nfile As Long
    Dim filename() As String
    Dim x As Long, length1 As Long, width1 As Long
    counter = 0
    Set Pic = Form1.Controls.Add("VB.PictureBox", "test")
    Pic.Visible = True
    If Right(Dir1.Path, 1) <> "\" Then
      source = Dir1.Path & "\" & Text1.Text
    Else
      source = Dir1.Path & Text1.Text
    End If
    hfile = FindFirstFile(source, wfd)
    If hfile = -1 Then
    MsgBox "沒有找到文件"
    End If
    counter = counter + 1
    Do
    nfile = FindNextFile(hfile, wfd)
    If nfile <> 0 Then
    counter = counter + 1
    End If
    Loop Until nfile = 0
    ReDim filename(counter) As String
    hfile = FindFirstFile(source, wfd)
    filename(0) = wfd.cFileName
    For i = 1 To counter
    nfile = FindNextFile(hfile, wfd)
    filename(i) = wfd.cFileName
    Next i
    If Right(Dir1.Path, 1) <> "\" Then
    source = Dir1.Path & "\"
    Else
    source = Dir1.Path
    End If
    Call FindClose(hfile)

    For i = 0 To (counter / 4)
    For j = 0 To 3
    piname = "picture" & j + 1 + i * 4
    Set obj = Form1.Controls.Add("VB.Image", piname)
    obj.Width = 1500
    obj.Height = 1500
    obj.Stretch = True
    Set obj.Container = Pic
    obj.Left = j * obj.Width
    obj.Top = i * obj.Height
    If (j + 1 + i * 4) > counter Then
    GoTo line
    End If
    obj.Picture = LoadPicture(source & (filename(j + 1 + i * 4)))
    obj.Visible = True
    Next j
    Next i
    line:
    width1 = j * obj.Width
    length1 = i * obj.Height
    Pic.Width = 4 * obj.Width
    Pic.Height = length1
    Pic.Left = Dir1.Left + Dir1.Width
    Pic.Top = 0
    width1 = 4 * obj.Width
    length1 = i * obj.Height
    VScroll1.Min = 0
    VScroll1.Max = 32767
    End Sub
    Private Sub Dir1_Change()
    File1.filename = Dir1.Path
    End Sub
    Private Sub Drive1_Change()
    Dir1.Path = Drive1.Drive
    End Sub
    Private Sub Form_Load()
    Combo1.Text = "*.jpg"
    Combo1.AddItem "*.bmp"
    Combo1.AddItem "*.gif"
    VScroll1.LargeChange = 200
    VScroll1.SmallChange = 50
    Text1.Text = Combo1.Text
    End Sub
    Private Sub VScroll1_Change()
    Pic.Top = 0 - VScroll1.value
    End Sub
    該程序在VB6.0+WINME環境下調試通過。

    延伸閱讀

    文章來源于領測軟件測試網 http://www.kjueaiud.com/


    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備10010545號-5
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>