T
T
TwilightSoul2018-12-04 18:54:15
Graphic arts
TwilightSoul, 2018-12-04 18:54:15

C# System.Graphics How to stretch an image?

Hello. I am writing an application in C# using WinForms. To render images I use the following code

e.Graphics.DrawImage(MatheMage.Properties.Resources.ChooseMenu, 0, 300);

I wanted to add support for full screen mode (At the moment, the window is 640:480). For this I used the code:
private void GameForm_Load(object sender, EventArgs e)
{
    this.TopMost = true;
    this.FormBorderStyle = FormBorderStyle.None;
    this.WindowState = FormWindowState.Maximized;
}

But oddly enough, a white space just appeared around the form to fill the screen.
Is there a way to simply scale the entire shape without overwriting the coordinates of all objects with the size of the already maximized window?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir S, 2018-12-04
@TwilightSoul

docks
use an overload that takes parameters with the original image size and target

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question