R
ryandailey21
Hello,
For some reason this ImageAttributes isn't doing what I tell it. I'm
not sure what I am missing. I am trying to get background of the image
to display as transparent. But it draws the image unchanged. Here's
my code.
Dim ImgColorMap(0) As System.Drawing.Imaging.ColorMap
Dim BackColor As Color
'Draw the Background
graph.DrawImage(BackGroundImage, 0, 0)
'Draw the board
BackColor = BoardImages(0).GetPixel(0, 0)
ImgColorMap(0) = New System.Drawing.Imaging.ColorMap
ImgColorMap(0).OldColor = New Color
ImgColorMap(0).OldColor.FromArgb(BackColor.A, BackColor.R,
BackColor.G, BackColor.B)
ImgColorMap(0).NewColor = New Color
ImgColorMap(0).NewColor.FromArgb(0, 0, BackColor.G, 0)
BoardImageAttributes = New
System.Drawing.Imaging.ImageAttributes
BoardImageAttributes.SetRemapTable(ImgColorMap)
graph.DrawImage(BoardImages(0), New Rectangle(50, 50, 50, 50),
28, 28, 50, 50, GraphicsUnit.Pixel, BoardImageAttributes)
For some reason this ImageAttributes isn't doing what I tell it. I'm
not sure what I am missing. I am trying to get background of the image
to display as transparent. But it draws the image unchanged. Here's
my code.
Dim ImgColorMap(0) As System.Drawing.Imaging.ColorMap
Dim BackColor As Color
'Draw the Background
graph.DrawImage(BackGroundImage, 0, 0)
'Draw the board
BackColor = BoardImages(0).GetPixel(0, 0)
ImgColorMap(0) = New System.Drawing.Imaging.ColorMap
ImgColorMap(0).OldColor = New Color
ImgColorMap(0).OldColor.FromArgb(BackColor.A, BackColor.R,
BackColor.G, BackColor.B)
ImgColorMap(0).NewColor = New Color
ImgColorMap(0).NewColor.FromArgb(0, 0, BackColor.G, 0)
BoardImageAttributes = New
System.Drawing.Imaging.ImageAttributes
BoardImageAttributes.SetRemapTable(ImgColorMap)
graph.DrawImage(BoardImages(0), New Rectangle(50, 50, 50, 50),
28, 28, 50, 50, GraphicsUnit.Pixel, BoardImageAttributes)