TooolbarButton transparency. A proposal of solution
The proposal is to acquire at runtime from the registry the color of the toolbar and use it to replace the 0.0 pixel color of the bitmaps of an ImageList.
I hope it is useful
Sub Globals
Dim Type (R,G,B) color
Dim binary(0) As Byte
Sub App_Start
' ...
' ...
if cPPC = True Then
' acquire the color...
reg.New1
reg.RootKey(reg.rtLocalMachine)
key = "System\GWE"
binary() = reg.GetValue(key,"SysColor")
RegOrder = 15 ' position of the BtnFaceColor (used by the toolbar)...
color.R = binary((4 * RegOrder)+0)
color.G = binary((4 * RegOrder)+1)
color.B = binary((4 * RegOrder)+2)
' replace the color...
For i = 0 To ImageList1.Count - 1
bitmap1.New3 (ImageList1.Item(i))
color0_0 = bitmap1.GetPixel1 (0, 0)
For x = 0 To bitmap1.Width -1
For y = 0 To bitmap1.Height -1
If bitmap1.GetPixel1 (x, y) = Color0_0 Then
bitmap1.SetPixel(x, y, Rgb (color.R,color.G,color.B))
End If
Next
Next
ImageList1.Item(i) = bitmap1.Value
Next
End If
' now we create the toolbarbuttons...
bar.New1("FormXXXX")
btn1.New1
bar.AddToolBarButton(btn1.Value)
btn1.Style = btn1.stToggleButton
bar.AddImage2(ImageList1.Item(0))
'...
|