Bitmap switch on/off

This forum is for eXpress++ general support.
Post Reply
Message
Author
Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Bitmap switch on/off

#1 Post 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 ?

User avatar
Tom
Posts: 1234
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Bitmap switch on/off

#2 Post 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
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: Bitmap switch on/off

#3 Post by Victorio »

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

Thank for advice Tom.

Victorio

User avatar
Auge_Ohr
Posts: 1428
Joined: Wed Feb 24, 2010 3:44 pm

Re: Bitmap switch on/off

#4 Post 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.
greetings by OHR
Jimmy

User avatar
digitsoft
Posts: 461
Joined: Thu Jan 28, 2010 1:33 pm
Location: Republica Dominicana
Contact:

Re: Bitmap switch on/off

#5 Post 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
Nolberto Paulino
Regards

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: Bitmap switch on/off

#6 Post by Victorio »

thanks to all of you,
I must try it.
Victorio

Post Reply