C# draw in PictureBox "removes DPI scale"

29 views Asked by At

I have a dialog box with a PictureBox. I am on a screen with 150% DPI scale... When the dialog box displays on the screen... All is ok. But as soon as I try assigning an image on the PictureBox, the dialog box scaling goes down to 100% and gets very small (for my screen).

I display the image on the PictureBox using:

pictureBox1.BackgroundImage = SharedResources.imageAsBitmap();

But I have also tried:

pictureBox1.Refresh();
Graphics g = pictureBox1.CreateGraphics();
g.DrawImage(SharedResources.imageAsBitmap(), new Rectangle(0,0,pictureBox1.Width,pictureBox1.Height));
g.Dispose();

with no differences...

Can you tell me what I am doing wrong?

Thanks, Cyrille

0

There are 0 answers