Heres how Ive solved the issue in the past. This is for a method which creates a colored icon from a template/mask image.
[code]Function IconWithColor(Icon As Picture, FillColor As Color, Overlay As Picture = Nil) As Picture
Dim Width As Integer = Icon.Width
Dim Height As Integer = Icon.Height
Dim Bitmaps() As Picture
For Factor As Integer = 1 To 3
Dim Mask As Picture = Icon.BestRepresentation(Width, Height, Factor)
Dim Pic As New Picture(Width * Factor, Height * Factor, 32)
Pic.VerticalResolution = 72 * Factor
Pic.HorizontalResolution = 72 * Factor
Pic.Graphics.ForeColor = RGB(FillColor.Red, FillColor.Green, FillColor.Blue)
Pic.Graphics.FillRect(0, 0, Pic.Width, Pic.Height)
Pic.Mask.Graphics.ClearRect(0, 0, Pic.Width, Pic.Height)
Pic.Mask.Graphics.DrawPicture(Mask, 0, 0, Mask.Width, Mask.Height, 0, 0, Mask.Width, Mask.Height)
If Overlay <> Nil Then
Dim OverlayMask As Picture = Overlay.BestRepresentation(Width, Height, Factor)
Pic.Mask.Graphics.DrawPicture(OverlayMask, 0, 0, Mask.Width, Mask.Height, 0, 0, OverlayMask.Width, OverlayMask.Height)
End If
Pic.Mask.Graphics.ForeColor = RGB(255, 255, 255, 255 - FillColor.Alpha)
Pic.Mask.Graphics.FillRect(0, 0, Pic.Width, Pic.Height)
Bitmaps.Append(Pic)
Next
Return New Picture(Width, Height, Bitmaps)
End Function[/code]
Basically, the key is creating multiple pictures at each scale factor, throwing them all into an array, and letting the framework figure out what to do with them from there.