Results 1 to 9 of 9

Thread: about pictures...

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    83
    is it possible to load a picture into a project, but not into an item(so a person wouldn't have to have the picture files AND the .exe just one big exe(i want to be able to change the picture of objects inside)?
    Ian Callanan
    VB6.0
    [email protected]

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Lightbulb Res file

    Just create a resource file (*.res) and copy all your graphics into it, then use the LoadResPicture function to load it at runtime.
    Code:
    Picture1.Picture = LoadResPictire(101,vbResBitmap)

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    83
    im still fairly new to vb....could you talk like i am 4?(no, i am not 4) how do i create the .res file, how do i copy graphics to it?(i figured out how to load graphics from a normal file, so i think i can fake the loading with what you gave me)
    Ian Callanan
    VB6.0
    [email protected]

  4. #4
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Lightbulb Are you using VB6.0?

    You need to load the Reasource File Editor at the begining when you load your VB IDE. This can be done with the following step:
    • Goto Add-ins|Add-In Manager.
    • Select the VB 6 Resource Editor.
    • Check the Loaded/Unloaded CheckBox.
    • Check the Load On Startup.


    After this few step, you will be able to see the Resource Editor Icon in you toolbar.

    Hence, To add image into the resource editor just do the following few step:
    • Load the resource Editor.
    • Add a new image by click on the Add bitmap icon.
    • Select your desire bitmap image file, the editor will adutomatic assign a ID for the image (E.g. 101)
    • Save the resource file in your project folder.
    • Add the resource file into your project. Right Click your mouse in the Project Browser Window and chose Add|Add File. Just point to your resource file and click OK.


    At this stage, all you need is to load the image by using the Picture1.Picture = LoadResPicture (101,vbResBitmap)


  5. #5
    Addicted Member
    Join Date
    Nov 1999
    Posts
    184
    Noo!

    Use a res file but store the files in
    JPEG. BITMAPS are too large.
    Then use this code to retreive the
    JPEG.

    Code:
     
    Public Sub LoadPic(Index As Integer)
    Dim arrByte() As Byte
    Dim IFFN As Integer
    Dim strTempPath As String
    arrByte = LoadResData(Index, "Custom")
    strTempPath = App.path & "\Loading.jpg"
    IFFN = FreeFile
    Open strTempPath For Binary As IFFN
    Put #IFFN, , arrByte
    Close #IFFN
    form1.picture1.Picture = LoadPicture(strTempPath)
    Kill strTempPath
    End Sub
    Evan Duffield --------
    --- [email protected]
    - -
    VB6 - Learning Edition
    - -


  6. #6
    Addicted Member
    Join Date
    Nov 1999
    Posts
    184
    To show you how I did that..

    VB will only accept a bitmap
    so I converted the jpeg and
    then saved it to the disk,
    and loaded it..

    If you have any problems with
    that code mail me,
    Or just reply.

    Evan Duffield --------
    --- [email protected]
    - -
    VB6 - Learning Edition
    - -


  7. #7

    Thread Starter
    Lively Member
    Join Date
    Jan 2000
    Posts
    83
    I am using VB6.0 and im using .gif (due to size mainly), is that a problem?
    Ian Callanan
    VB6.0
    [email protected]

  8. #8
    Addicted Member
    Join Date
    Nov 1999
    Posts
    184
    Nope..
    use the same code.
    just load the picture as a custom
    resource and then in a command button
    put this

    Loadpic 101

    Then your need a picture box on the
    form and the picture should load.

    Tell be what happens.
    Evan Duffield --------
    --- [email protected]
    - -
    VB6 - Learning Edition
    - -


  9. #9
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    India
    Posts
    298
    Is there any way I can use the resource editor to store jpeg files??????

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width