[Gambas-user] Pictures on buttons doesn't work correctly anymore

Benoît Minisini gambas at ...1...
Wed Aug 27 16:35:58 CEST 2014


Le 27/08/2014 16:26, Jussi Lahtinen a écrit :
>
>     You are not drawing on button face! You are drawing inside a picture
>     that you have filling with Color.Transparent.
>
>
> OK, understood.
>
>     Picture are always opaque, but can have a mask. Then we are talking
>     about "transparent" picture, but they are not really transparent.
>
>
> OK, this was my confusion. Also picture property name makes this
> confusion, property "transparent" should be "mask"... unless in future
> they will serve same purpose.
>
>
>     By filling the opaque picture with Color.Transparent, you are
>     actually filling it with the opaque color represented by the three
>     lower bytes of Color.Transparent, which was FFFFFF (white) before
>     and now is 000000 (black).
>
>     So you were just putting a white image with a black circle inside
>     before, and now with a black image with a black circle inside.
>
>
> OK, I understand now. Is there way to define the mask for picture via
> Gambas? Example to use certain color as mask?
>

If you want to forge your own button picture, don't use a Picture! Just 
use an Image, and transform it into a Picture the later possible, i.e. 
when you want to assign the image to the button.

Dim hImage As Image

hImage = new Image(...)
Paint.Begin(hImage) ' Or Draw.Begin() for the old deprecated API
...
Paint.End

MyButton.Picture = hImage.Picture

Regards,

-- 
Benoît Minisini




More information about the User mailing list