|
■No95752 (OA さん) に返信
とりあえず、面倒ですがImageAttributes.SetRemapTableで色を入れ替えて
GDI+でDrawImageすることで対応しました。
もっと簡単な方法があれば教えてください。
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Using bmp As New Bitmap(32, 32), g = Graphics.FromImage(bmp), g1 = Me.CreateGraphics
Dim rect As New Rectangle(0, 0, 32, 32)
ComboBoxRenderer.DrawDropDownButton(g, rect, VisualStyles.ComboBoxState.Pressed)
Dim orgColor = bmp.GetPixel(1, 1)
Dim destColor = Color.Orange
Dim map() = {New System.Drawing.Imaging.ColorMap() With {.OldColor = orgColor, .NewColor = destColor}}
Using ia As New System.Drawing.Imaging.ImageAttributes()
ia.SetRemapTable(map)
g1.DrawImage(bmp, rect, 0, 0, bmp.Width, bmp.Height, GraphicsUnit.Pixel, ia)
End Using
End Using
End Sub
|