This is because the background of the bitmap is a transparent black. Try to make it a transparent white before drawing:
gfx.Clear(Color.FromArgb(0, 255, 255, 255));
Apparently this does not change anything. Use TextRenderer.DrawText
instead. It allows you to specify a background color:
TextRenderer.DrawText(gfx, "text", font, point, foreColor, backColor);
However it might just fill the text rectangle. I'm not sure. Or repeat what we have done above (gfx.Clear(...)
) with an overload of TextRenderer.DrawText
that does not have a backColor.
gfx.Clear(Color.FromArgb(1, 255, 255, 255));
TextRenderer.DrawText(gfx, "text", font, point, Color.White)
All these tricks just seem to have no effect at all. The only option left seems to be to disable anti-aliasing. This is done with SmoothingMode
for non-text drawing (lines circles etc.) and TextRenderingHint
for text rendering.
gfx.TextRenderingHint = TextRenderingHint.SingleBitPerPixelGridFit; // For text
gfx.SmoothingMode = SmoothingMode.None; // For geometrical objects