Public Group

# form scaling

This topic is 3939 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello :) Im trying to achieve the following in C#: when the form loads, it should scale vertically (Y axis) with a number of pixels. I searched the msdn but only found methods of drawing inside the form, some scaled rectangles. I dont need scaled rectangles inside the form, I need to scale the form itself. Here's what I wrote so far:

private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g;
g = e.Graphics;
g.SmoothingMode = SmoothingMode.HighQuality;
g.RotateTransform(45);
Rectangle recForm = new Rectangle(0, 0, this.Width, this.Height);
Pen pen = new Pen(Color.Black);
g.DrawRectangle(pen, recForm);

}

}


where is my mistake? I thought when I call DrawRectangle, it redraws my form, but it actually draws inside it. edit - oh yes I posted by mistake the code for rotating not scaling but its the same thing. It affects drawings inside the form not the form itself. I tried scaling too , it does not work. Regards,

##### Share on other sites
I don't really use C#, but doesn't the form object have a resize method(maybe in a super class) that you could use in the action handler when the form loads?

1. 1
2. 2
frob
16
3. 3
4. 4
5. 5

• 14
• 13
• 14
• 72
• 22
• ### Forum Statistics

• Total Topics
632143
• Total Posts
3004330

×