N3v3r G1v3 uP

Showing image picture in different types

03/11/2009 16:04

design program to showing image pictures in many type. steps must be doing are

1. design program like this picture below

2. makew procedure on the form activate and type program listing like below. this mean to make list on the combo box

Private Sub Form_Activate()
   Combo1.Text = "*.*"
   Combo1.AddItem "*.bmp"
   Combo1.AddItem "*.jpg"
   Combo1.AddItem "*.gif"
   Combo1.AddItem "*.*"
   Image1.Visible = False
End Sub

3. drive click on the drive1 and make procedure change this mean to choose working of drive

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

3. do double click on the object dir1 and make procedure dir1 with funtion change. this mean to choose folder and file which is saved.

Private Sub Dir1_Change()
  File1.FileName = Combo1.Text
  File1.FileName = Dir1.Path
  gambar_kosong
End Sub

4. make procedure file click this mean to choose image/picture will be showed


Private Sub File1_Click()
  On Error GoTo salah
  Image1.Visible = True
  Image1.Picture = LoadPicture(Dir1.Path & "\" & File1.FileName)
  Exit Sub
salah:
  MsgBox "file yang dipilih bukan file gambar"
  Combo1.SetFocus
End Sub

5. make procedure in combo1 like listing below

Private Sub Combo1_Click()
   File1.FileName = Combo1.Text
   gambar_kosong
End Sub

Private Sub Combo1_KeyPress(KeyAscii As Integer)
   If KeyAscii = 13 Then
   File1.FileName = Combo1.Text
   End If
End Sub

6. make procedure with command botton BERSIH, SEMBUNYI, TAMPIL DAN SELESAI. each command listing like below

Private Sub Command1_Click()
  Image1.Picture = Nothing
End Sub

Private Sub Command2_Click()
  Image1.Visible = False
End Sub

Private Sub Command3_Click()
Image1.Visible = True
End Sub

Private Sub Command4_Click()
Unload Me
End Sub

7. make procedure gambar-kosong to clean up picture or image.

Sub gambar_kosong()
  If File1.ListCount = 0 Then
    Image1.Picture = Nothing
    End If
End Sub

8. and then finally the result of the program is like picture below

Subscribe
Back

Topic: Showing image picture in different types

No comments found.

Search site

ranto© 2010 All rights reserved.