I can draw a line on image by using below code. Width of pen is fixed as 5. There is a dropdown for selecting resolution of screen (640*480,352*288,320*240 etc). When selecting it, screen will change into that resolution. As a result the width of pen seems different. In each resolution pen width looks different. How can I fix the width of pen for all resolution?
public void DrawLineInt(Bitmap bmp)
{
Pen blackPen = new Pen(Color.Black, 5);
int x1 = 100;
int y1 = 100;
int x2 = 500;
int y2 = 100;
// Draw line to screen.
using (var graphics = Graphics.FromImage(bmp))
{
graphics.DrawLine(blackPen, x1, y1, x2, y2);
}
}