Selasa, 03 Februari 2009

Fungsi Dir List Box & Common Dialog

Drive List Box : untuk menampilkan Drive
Directory List Box : untuk menampilkan Directory
File List Box : untuk menampilkan File Name


Lihat code dibawah:
Object Properties Nilai
FileListBox Pattern *.jpg;*.gif;*.bmp;*.ico
Image Strecth True
Form Caption Browser Gambar

Fungsi Common Dialog : untuk menampilkan penggunaan dialog open, save, font, print, color dan lain-lain.
Filter : “All files (*.*) | *.* | jpg files (*.jpg) | *.jpg | “ & gif files (*.gif) | *.gif”

Contoh Program
>> Form DirListBox
>> Code
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub

Private Sub Drive1_Change()
Dir1.Path = Drive1.Drive
End Sub

Private Sub File1_Click()
filegambar = File1.Path + "/" + File1.FileName
Image1.Picture = LoadPicture(filegambar)
Form1.Caption = filegambar
End Sub

>> Form Common Dialog
>> Code
Private Sub Command1_Click()
CommonDialog1.Filter = "All files (*.*)|*.*|JPG Files(.*jpg)|*.jpg|& GIF Files(*.gif)|*.gif"
CommonDialog1.DialogTitle = "Buka File"
CommonDialog1.ShowOpen
filegambar = CommonDialog1.FileName
Image1.Picture = LoadPicture(filegambar)
Form1.Caption = filegambar
End Sub

Tidak ada komentar: