[Gambas-user] transparent button

Charlie Ogier charlie at cogier.com
Mon Oct 26 18:50:33 CET 2020


Hi K,

I can't see away to make a button transparent, but why not use something 
else? Try running the code below in a 'Graphical application'

'*******************************************

' Gambas class file

DrawingArea1 As DrawingArea
Label1 As Label

Public Sub DrawingArea1_Draw()

   Paint.Begin(DrawingArea1)
   Paint.Font.Size = 16
   Paint.Font.Bold = True
   Paint.Text("Click me!", 0, 0, DrawingArea1.W, DrawingArea1.H, 3)
   Paint.Fill
   Paint.Stroke
   Paint.End

End

Public Sub DrawingArea1_MouseDown()

   DrawingArea1.Border = Border.Sunken

End

Public Sub DrawingArea1_MouseUp()

   If Label1.Text = "" Then Label1.Text = "You clicked me" Else 
Label1.Text = ""
   DrawingArea1.Border = Border.Raised

End

Public Sub Form_Open()

   With Me
     .H = 200
     .W = 400
     .Background = Color.White
     .Picture = Picture["icon:/128/sun"]
   End With

   With Label1 = New Label(Me) As "Label1"
     .H = 42
     .W = 200
     .X = 200
     .Y = 100
     .Font.Size = 16
     .Font.Bold = True
   End With

   With DrawingArea1 = New DrawingArea(Me) As "DrawingArea1"
     .x = 50
     .y = 100
     .H = 42
     .W = 100
     .Border = Border.Raised
   End With

End
'********************************


On 26/10/2020 14:22, KKing wrote:
> can you set button to be transparent I tried
> hButton.Background = Color.Transparent
> but the button is Black?
> K.
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----



More information about the User mailing list