Announcement

Collapse
No announcement yet.

Load and display bmp at run time

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Load and display bmp at run time

    I'm very new to PBWin 9 (just purchased it little over a week ago) and I have a question (so I will probably have a lot others in the next weeks).

    I know how to display and use images (bmp) when I load them in a resource file. This wouldn't be a problem.

    However, what I want to do is be able to load and display a bitmap (bmp and/or jpg) at run time. I'm creating a small learning environment for my baby daughter and need to be able to add stuff (text and images) to it as she grows. The way I want to do this is by creating datafiles that will reference image files stored in the harddisk.
    So I need to be able to, after reading the datafile, also load the corresponding image files and display on the screen.

    In VB (6 and 2008 .Net) where I come from, this is no problem for me, in PBWin9 I can't find the appropriate code/commands for it.

    Could someone point me in the right direction (I own PBWin9, PBForms 1.5 and GraphicTools 2.

  • #2
    Try:
    GRAPHIC BITMAP LOAD BmpName$, nWidth&, nHeight& [,stretch&] TO hBmp???
    And welcome to PB.
    Rod
    I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

    Comment


    • #3
      I've tried this code

      I'm displaying text on a form (from an array) based following a click event on a 'forward or reverse' button.
      Code:
         LOCAL hImage AS DWORD
         IF intcurnum > intcounter THEN
            intcurnum = 1
         ELSEIF intcurnum < 1 THEN
            intcurnum = intcounter
         END IF
         intpointer = intcurnum
         CONTROL SET TEXT hDLG, %lblCharacter, strCharacter(intCurNum) 'Display text
         CONTROL SET TEXT hDLG, %lblPinyin, strMeaning(intCurNum) 'Display text
         CONTROL SET TEXT hDLG, %lblWord, strMeaning(intCurNum) 'Display text
         GRAPHIC BITMAP LOAD  "data\images\aap.bmp" ,0,0,0 TO hImage 'For test purposes one fixed file name. Folder is offset from current application folder. Image exists
         GRAPHIC ATTACH hDLG, %imgImage, REDRAW
         DIALOG DOEVENTS
      But this doesn't give me a result. I don't get error messages and the code is executed when I step through it, but no image is displayed.
      The image control has the 'vissible' property set to true

      Comment


      • #4
        Try the GRAPHIC RENDER statement.

        If you post that compiles and runs and shows the problem it's easier to give help on the problem.
        Rod
        I want not 'not', not Knot, not Knott, not Nott, not knot, not naught, not nought, but aught.

        Comment


        • #5
          Originally posted by Rodney Hicks View Post
          Try the GRAPHIC RENDER statement.

          If you post that compiles and runs and shows the problem it's easier to give help on the problem.
          Just found another (better??) solution: I also have graphic Tools Pro and the gfx window there does exactly what I want.

          Thanks anyway:wave:.

          Comment

          Working...
          X