• Advertisement
Sign in to follow this  

form scaling

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement