How refresh a bitmap into dialog

How refresh a bitmap into dialog

Postby Silvio » Wed Mar 26, 2008 9:03 am

Code: Select all  Expand view  RUN
  #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
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Antonio Linares » Wed Mar 26, 2008 5:57 pm

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
Antonio Linares
Site Admin
 
Posts: 42122
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Refresh Bitmaps

Postby ukoenig » Fri Mar 28, 2008 11:19 am

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Willi Quintana and 71 guests