When saving a gif file in VB 2005 with a custom brush color the background
if the image is dithered. When I save the image as any other type but gif
the background is not dithered. What can I do to fix this?
Below is my code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim outstr As String = "REDUCED - Ralph Lauren 2T pants new"
Dim myfontstyle As FontStyle = FontStyle.Bold + FontStyle.Underline
Dim outfont As Font = New Font("ARIAL", 10, myfontstyle)
Dim bmp As Bitmap = New Bitmap(456, 100)
Dim canvas As Graphics = Graphics.FromImage(bmp)
Dim mycolor As Color = Color.FromArgb(255, 213, 218, 219)
Dim mybrush As SolidBrush = New SolidBrush(mycolor)
canvas.FillRectangle(mybrush, 0, 0, 456, 100)
canvas.DrawString(outstr, outfont, Brushes.Blue, 10, 10)
bmp.Save("c:\mytest.gif", System.Drawing.Imaging.ImageFormat.Gif)
End Sub
Thanks,
pete