回覆列表
  • 1 # 誰暖冬季影紫茶色

    請按如下步驟操作。

    “工程”“部件”“MicrosoftWindowsCommonControls6.0/5.0”

    建立如下控制元件

    Command1

    Command2

    Command3

    Text1

    ImageList1

    Picture1(如果用Image,Stretch=True效果會更好)

    在設計檢視中右擊Imagelist1,單擊屬性,選擇“影象”選項卡,單擊“插入圖片”,並在“關鍵字”中可以一一說明(就是你說的“檔名”,查詢起來方便),圖片全弄好後,單擊確定。

    程式碼如下。

    DimnAsInteger

    PrivateSubCommand1_Click()

    OnErrorGoToe

    n=n-1

    Picture1.Picture=ImageList1.ListImages.Item(n).Picture

    ExitSub

    e:

    MsgBox"上一張沒有圖片了"

    n=n+1

    EndSub

    PrivateSubCommand2_Click()

    OnErrorGoToe

    n=n+1

    Picture1.Picture=ImageList1.ListImages.Item(n).Picture

    ExitSub

    e:

    MsgBox"下一張沒有圖片了"

    n=n-1

    EndSub

    PrivateSubCommand3_Click()

    OnErrorGoToe

    Picture1.Picture=ImageList1.ListImages(Text1.Text).Picture

    ExitSub

    e:

    MsgBox"未找到符合此關鍵字的圖片"

    EndSub

    PrivateSubForm_Load()

    n=1

    Command1.Caption="上一張"

    Command2.Caption="下一張"

    Command3.Caption="查詢"

    Picture1.Picture=ImageList1.ListImages.Item(n).Picture

    Text1.Text=""

    EndSub

    以上程式經測試符合你的要求,並且隨著EXE檔案一起生成。

  • 中秋節和大豐收的關聯?
  • 糖稀是什麼做的?