How refresh a bitmap into dialog

Post Reply
User avatar
Silvio
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

How refresh a bitmap into dialog

Post 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?
Best Regards, Saludos

Falconi Silvio
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post 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 )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
ukoenig
Posts: 3981
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany
Contact:

Refresh Bitmaps

Post 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
Since 1995 ( the first release of FW 1.9 )
i work with FW.
If you have any questions about special functions, maybe i can help.
Post Reply