Page 1 of 1

Bitmap switch on/off

Posted: Tue Oct 02, 2018 5:50 am
by Victorio
Hi,
I have background bitmap on main app window like this :
oBitmap:=DC_GetBitmap("Raukn3.jpg",,,,{aSize[1]*0.99,(aSize[2]*0.89)-(8.5*fontnv)+6})
DCGETOPTIONS ;
BITMAP oBitmap ;
ICON ICON_EXPRESS ;
FONT fontnt ;
EVAL { || SetAppWindow(oMenuBarh), ;
oTimer1 := DC_SetTimerEvent():new( 200,{ || _UpdateStats(GetList) } )}

DCREAD GUI SETAPPWINDOW ;
TITLE "RAUKN Win"+verzia ;
OPTIONS GetOptions

When I want load big button to this place, and use DCPUSHBUTTON rounded border it is not ok, because on button place stay blank space with square corners. This look as first delete rectangle area and then load button. When button is rectangle it is ok, but when rounded then stay little pieces without bitmap area.

Because this I want swith off background bitmap when activate buttons and when close buttons , again load bitmap

How can I switch on/off loaded bitmap ?
Can I use some code block for BITMAP oBitmap ; ? to switching this ?

Re: Bitmap switch on/off

Posted: Tue Oct 02, 2018 6:09 am
by Tom
Hi, Victorio.

If you post source-code, please use the "Code"-tag to highlight it. It's much better readable then.

Try something like this:

Code: Select all

FUNCTION ChangeBitmap(oDlg,cBitmap)
IF !Empty(cBitmap)
  oDlg:DrawingArea:options := XBP_IMAGE_SCALED
  oDlg:DrawingArea:SizeRedraw := .T.
  oDlg:DrawingArea:bitmap := DC_GetBitmap(cBitmap)
  ELSE
  oDlg:DrawingArea:bitmap := NIL
ENDIF
oDlg:DrawingArea:Configure()
RETURN NIL

Re: Bitmap switch on/off

Posted: Tue Oct 02, 2018 7:29 am
by Victorio
I did not recognize these controls, in future I will use it ...

Thank for advice Tom.

Victorio

Re: Bitmap switch on/off

Posted: Tue Oct 02, 2018 11:40 am
by Auge_Ohr
hi,
Victorio wrote:When I want load big button to this place, and use DCPUSHBUTTON rounded border it is not ok, because on button place stay blank space with square corners. This look as first delete rectangle area and then load button. When button is rectangle it is ok, but when rounded then stay little pieces without bitmap area.
i think DCPUSHBUTTON use GRAEDGE() for round Corner which does not meet your Backgound Bitmap.
i think XPPUSHBUTTON use CreateEllipticRgn() / SetWindowRgn() which should work.

Re: Bitmap switch on/off

Posted: Tue Oct 02, 2018 2:00 pm
by digitsoft
Hello
I have been using this function for years and it works very well for me


FUNCTION ChangeBitmap( oDlg, cBitMap )
local oPS, oImage

DC_PointerWait( )
if ValType(oDlg) = "O"
oDlg:lockUpdate(.T.)
oDlg:options := XBP_IMAGE_SCALED
oDlg:SizeRedraw := .T.
oDlg:bitmap := DC_GetBitmap(cBitMap)
oDlg:configure( ):invalidateRect( )
oDlg:LockUpdate(.F.)
END if
return DC_PointerArrow( )


Victorio wrote:I did not recognize these controls, in future I will use it ...

Thank for advice Tom.

Victorio

Re: Bitmap switch on/off

Posted: Wed Oct 03, 2018 1:12 am
by Victorio
thanks to all of you,
I must try it.
Victorio