Page 1 of 1

How refresh a bitmap into dialog

Posted: Wed Mar 26, 2008 9:03 am
by Silvio

Code: Select all

  #Include "FiveWin.Ch"

Static oDlg,oBmp


FUNCTION Main()
   LOCAL oFont

   LOcal  cBitmap:= "c:\fwh\bitmaps\blinker1.bmp"    // sample bitmap
   
   DEFINE FONT oFont NAME GetSysFont() SIZE 0, -8

   DEFINE DIALOG oDlg SIZE 255, 245 TITLE "TEst BITMAP" FONT oFont





   ACTIVATE DIALOG oDlg CENTERED             ;
   on Paint Start(cBitmap)                  ;
   ON INIT   oDlg:SetMenu( Menudlg(oDlg))



   RETURN (Nil)

Function Start(cBitmap) 

// Bitmap
      oBmp:=TBitmap():Define( , cBitmap, oDlg )
      PalBmpDraw(oDlg:hDC,0,0,oBmp:hBitmap,oBmp:hPalette,oDlg:nWidth,oDlg:nHeight)

return nil

Function Menudlg(oDlg)
     Local oMenu
    MENU oMenu 2007
       MENUITEM  "Insert Bitmap "
          MENU
             MENUITEM  "First Bitmap "  action (cbitmap:="c:\fwh\bitmaps\blinker1.bmp",odlg:refresh())
             MENUITEM  "Second Bitmap " action (cbitmap:="c:\fwh\bitmaps\blinker2.bmp",odlg:refresh())

          ENDMENU
ENDMENU

How I can refresh the bitmap into dialo g?

Posted: Wed Mar 26, 2008 5:57 pm
by Antonio Linares
Silvio,

You should not do it that way, as you are creating a new bitmap _every_time_ the dialog is painted!

Create the bitmap just once and then later on, change the image using:
oBmp:LoadBMP( cBmpFile )

Refresh Bitmaps

Posted: Fri Mar 28, 2008 11:19 am
by ukoenig
Hello Silvio,

exactly that i had to do in the new designer-update.
Im using just one bitmap from resource
and do a new paint on the bitmap with colors,
brushes, everything i need.
You can see it on the bottom of the gradient-creation.
There are 2 Bitmaps : 1 with start-color and 2. with end-color.
They change every time, when i choose different colors.

Regards

Uwe