### Button Set Style Transparent

Various way of setting a Button Style to transparent.
CSSUtils Library
Use the CSSUtils library to set a Button Style to Transparent.
Dim MyButton as Button
CSSUtils.SetStyleProperty(MyButton, "-fx-background-color", "transparent")
If the Button should contain an Image, use the CSSUtils Library and the B4J Visual Designer.
Set the Style
Dim MyButton as Button
CSSUtils.SetStyleProperty(MyButton, "-fx-background-color", "transparent")
Add the Image to the Button in the B4J Visual Designer
Button > Properties > Background Properties: Set
Drawable: Bitmap
Image File: Select a file from the files list. Copy the image to the files folder and add to the files list.
Gravity: Center
External CSS File
Steps:
• Create a CSS file, Main.css as an example, in the project files folder (dirassets)
• Add the file to the B4J IDE Files Manager
• Add the file to the form stylesheet.
/*
Project: Lighthouse58
File: Main.css
Set additional CSS styles
*/
.button {
-fx-background-color: transparent;
}
Add the file Main.css to the B4J IDE Files Manager.
Add the file Main.css to the form stylesheet.
`Private Sub Class_Globals
Private MainForm As Form
...
MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "Main.css"))
or
`Private Sub Class_Globals
Private frm As Form
...
frm.Stylesheets.Add(File.GetUri(File.DirAssets, "Main.css"))
``

Changed: , Category: CSS, File: T6C177M1283.htm, ID: 1283