Avatar billede mc_goblen Praktikant
14. november 2001 - 11:21 Der er 11 kommentarer og
1 løsning

Åben et billede


Skal bruge en kommando så jeg kan åbne et billede på harddisken som jeg selv vælger… Derefter skal billedet automatisk indsættes i en ramme eller noget og konverteres til en bestemt størrelse. Eks 5 cm x 5 cm – kom i sving med et svar, der er masser af point :p
Avatar billede terry Ekspert
14. november 2001 - 11:27 #1
How are you going to choose the picture from your harddisk?
Avatar billede terry Ekspert
14. november 2001 - 11:32 #2
Place an image object on the from and set its sizeMode propert to strech

Then use the following code to change the picture
Image0.Picture = \"C:\\Your.BMP\"
Image0.Width = 5
Image0.Height = 5
Avatar billede terry Ekspert
14. november 2001 - 11:32 #3
That was an answer
Avatar billede terry Ekspert
14. november 2001 - 11:33 #4
strech = stretch
Avatar billede terry Ekspert
14. november 2001 - 11:41 #5
you can use the common Dialog to find the file you want to see.
Avatar billede terry Ekspert
14. november 2001 - 12:08 #6
You can use the common dialog control for findiing the picture in this example it is a BMP file.
You have to have a reference to the common dialog. You can find the control under tools+refereneces menu while in code view.

Then you need an image control as mentioned in my first answer. In th eexample I use a button to change the picture. The common dialog is named dlgFileOpen.

Private Sub Command1_Click()
Dim spicture As String

spicture = dlgFileSearch

If spicture <> \"\" Then

    Image0.Picture = spicture
    Image0.Width = 1440 * 6  \' 1440 twips = 1 inch.
    Image0.Height = 1440 * 6  \' 1440 twips = 1 inch.

End If


End Sub


Private Function dlgFileSearch() As String
Dim strFileName As String
Dim strPath As String
Dim iPos As Integer
   
    \' Set CancelError is True
    dlgFileOpen.CancelError = True
   
    On Error GoTo Err_dlgFileSearch
 
    \' Set flags
    dlgFileOpen.Flags = cdlOFNHideReadOnly + cdlOFNFileMustExist
    \' Set filters
 
    dlgFileOpen.Filter = \"Picture Files (*.bmp)|*.bmp\"
   
    \' Specify default filter
    dlgFileOpen.FilterIndex = 2
    \' Display the Open dialog box
    dlgFileOpen.ShowOpen
    \' Display name of selected file
 
    If Not IsNull(dlgFileOpen.filename) Then
        dlgFileSearch = dlgFileOpen.filename
    Else
        dlgFileSearch = \"\"
    End If
       
Exit_dlgFileSearch:
    Exit Function
   
Err_dlgFileSearch:
    \'User pressed the Cancel button
    Resume Exit_dlgFileSearch

End Function
Avatar billede mc_goblen Praktikant
14. november 2001 - 13:22 #7
Hejsa Terry... Det lyder meget rigtigt det som du skriver, men jeg skal bruge en knap så jeg kan indsætte et nyt billede i hver post...  Billedet skal så indsættes i et lille format på siden eks 5x5 cm. Derefter skal jeg bare kunne trykke på det lille billede og bliver vist i orginal størrelse... Hjælp !
Avatar billede terry Ekspert
14. november 2001 - 13:34 #8
Et billede i hver post! There was no mention that the picture had to be put in a table!

I need som emore information! Do you display one record or multiple records (list) on the form. If its multiple are you expecting to show a pciture on each line (record).

Do you want to store the file name or the file in the dB? Files fill quite a bit.

If you want I can display the picture in the program which is Associated with the file types for example Paint with BMP.




Avatar billede terry Ekspert
14. november 2001 - 19:46 #9
mc_goblen>Do you want help on this? I could take a look at the database if you sent it!
Avatar billede mc_goblen Praktikant
15. november 2001 - 08:08 #10
Hello Terry... It would be nice if you would take your time to look at the database... If you send me you\'r e-mail-adress I will mail the database to you... Cya :o)
Avatar billede terry Ekspert
15. november 2001 - 08:10 #11
OK! dktebrsa@europe.lego.com

Could to also gibe me more information. tables/forms to look at etc.
Avatar billede terry Ekspert
15. november 2001 - 13:57 #12
Thanks martin! Dont forget the other question :O)

http://www.eksperten.dk/spm/133677

If you still have problems then let me know!
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester