I have an image being displayed in a form that is being stretched to 3x its original size.
I want to write text onto the image, without that text being stretched.
Is this possible, and if so, how?
I tried (in refresh method):
//On Form //my Bitmap
ImageDisplay.Image = IntensityBMP;
Graphics g = Graphics.FromImage(ImageDisplay.Image);
g.DrawString("MyText", new Font("Tahoma", 8), Brushes.White, etc);
and
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.DrawString("MyText", new Font("Tahoma", 8), etc);
base.OnPaint(e);
}
Both draw the text on the pre-stretched image, resulting in pixelated, too large text.
You need to draw the text after the PictureBox has rendered it’s image.
Either:
OR
Create a
PictureBox-derived class and overridePaint