Is the Icon a text Icon (Font awesome or material Icon) ?
Yes. Apologies I did not mention that.
I use FontAwesome icons for most of my menu, toolbar and navigation buttons. This after I found the following forum post from Erel:
Example creating dynamically FontAwesome icons for a MenuBar. This solution, see Sub TextToImage, uses a label which font is set to FontAwesome, add to a pane, followed by a screenshot which creates the image and then make the label invisible. The image is added to the menu items via a list...
My applications's
TextToImage function has some slight variations:
Sub TextToImage(p As Pane, s As String, FontSize As Double) As Image
Dim img As Image
Dim lbl As Label
lbl.Initialize("lbl")
lbl.Font = gFX.CreateFontAwesome(FontSize)
lbl.Text = s
p.AddNode(lbl, -1, -1, -1, -1)
img = lbl.Snapshot2(gFX.Colors.Transparent)
lbl.Visible = False
Return img
End Sub
But I just experimented, and if I replace line 9 with
instead, your suggested changes yield (3 button examples this time):
Closer, but not the ultimate solution.
It seems setting the background as transparent (at label snapshot time, as above at least) prevents the revised CSS from working properly/fully.