Announcement

Collapse
No announcement yet.

Graphics Bitmap load ??? need help

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

  • Graphics Bitmap load ??? need help

    Need help in GRAPHICS.

    Want to load a bitmap to a graphics window. I have used a sample from PB and modified it. I will want to display up to four gaphics windows in one dialog window with bitmaps but I am having a hard time understanding the simple graphic steps to just display a bitmap on one window.

    I have attached the modified program.

    Read several forum articles but could find a match to what I was looking for.
    Attached Files
    Last edited by Robert Alvarez; 10 Aug 2008, 07:48 PM.
    Robert

  • #2
    Replace
    GRAPHIC BITMAP LOAD
    with
    GRAPHIC RENDER

    GRAPHIC BITMAP LOAD loads image into memory, not into the graphic control.

    Cheers,
    Dale

    Comment


    • #3
      Made change and still no image

      Code:
      This is the graphic window in PBMAIN
          CONTROL ADD GRAPHIC, hDlg, %IDC_GW2, "",255,255,200,200 
      
      Changed lines in MainDlgProc() :
                  GRAPHIC RENDER "TESTPIC2.BMP",(255,255)-(200,200)
                  GRAPHIC ATTACH CBHNDL, %IDC_GW2, REDRAW
      Robert

      Comment


      • #4
        Hi Robert,

        the reason why it isn't drawing is "bad coordinates" in my opinion.
        You specify target coordinates in global dialog coordinate system, but when working with graphic, just use its local coordinates.

        That means - you created both GRAPHIC controls as 200x200, positioned somewhere. Ignore position, use width, height ( just with zero start, unless going for scaling ).

        If you want to render image to IDC_GW2, use this:
        Code:
                    GRAPHIC ATTACH CBHNDL, %IDC_GW2, REDRAW
                      GRAPHIC RENDER "TESTPIC2.BMP",(0,0)-(199,199)
                    GRAPHIC REDRAW
        - First line attaches graphic for drawing, your code first drawed and then attached
        - Second line renders whole image to fit rectangle (0,0)-(199,199)
        - Last line updates the control

        If you dislike starting from zero, you can use following, alternatively:
        Code:
                    GRAPHIC ATTACH CBHNDL, %IDC_GW2, REDRAW
                      GRAPHIC SCALE (1, 1)-(200, 200)
                      GRAPHIC RENDER "TESTPIC2.BMP",(1,1)-(200,200)
                    GRAPHIC REDRAW
        Maybe it would be safer to supply image using full path, to retrieve path of your program, see this topic with AppPath function.


        Bye,
        Petr
        Last edited by Petr Schreiber jr; 11 Aug 2008, 01:34 AM.
        [email protected]

        Comment


        • #5
          "bad coordinates" was the problem along with changing to RENDER.

          Thanks Petr and Dale
          Robert

          Comment

          Working...
          X