Posted 1 February 2021, 2:11 am EST
Hi Prabhat,
I have hundreds of svg icons which I convert to images used to create C1BitmapIcon objects which are then added into the RibbonButtons.IconSet. This is not ideal since monochrome C1PathIcons automatically change color based on the C1Theme selected which is a GREAT feature. Is there a way to have C1BitmapIcons automatically change color? I have tried drawing them with Color.Transparent, but that doesn’t work.
Also, could you find out what theme color is used to repaint C1PathIcons for RibbonButtons on a ribbon menu based on the theme? I use “C1Ribbon365\Form\Buttons\Default\GlyphColor” but I don’t think that is exactly right.
I tried the following code to simplify the svg data (based on your changes to the blank-page.svg), and it worked for some but not all cases.
Private Function kludgeFixSvg(resource As String) As String
'strip out elements and properties that confuse the C1 icon renderer
Dim xdocResource = XDocument.Parse(resource)
Dim ns = xdocResource.Root.GetDefaultNamespace
Dim xeIn = xdocResource.Element(ns + "svg")
Dim xeOut = New XElement("svg")
xeOut.Add(xeIn.Attribute("height"))
xeOut.Add(xeIn.Attribute("width"))
xeOut.Add(xeIn.Attribute("viewBox"))
For Each xeInG In xeIn.Elements(ns + "g")
Dim xeInPaths = xeInG.Elements(ns + "path")
If xeInPaths.Count > 0 Then
Dim xeOutG = New XElement("g")
For Each xeInPath In xeInPaths
xeOutG.Add(New XElement("path", xeInPath.Attributes("d")))
Next
xeOut.Add(xeOutG)
End If
Next
Dim resourceOut As String = xeOut.ToString
Return resourceOut
End Function
Here is an example of a simple svg file that will not render:svgNew.zip