Avatar of ayha1999
ayha1999
 asked on

Form and screen resolution

Hi,

I have a form in C# 2010 with a size width 768 and height 1036. the developing pc's screen resolution is 1280x1024. When I load the form some part is out the screen. I use printDocument to print the form and I can print the full form regardless of what is displayed on the screen. But when I install the application in another pc with a resolution of 1440x900, the form loads and some part is out screen as in the development pc. But when I when the print form, it prints only the area displayed on the screen. Is there any workaround to solve this problem using resolution settings?

code

       void PrintImage (object o, PrintPageEventArgs e)
       {
          int x = SystemInformation.WorkingArea.X;
          int y = SystemInformation.WorkingArea.Y;
          int width = this.Width;
          int height = this.Height;

          Rectangle bounds = new Rectangle (x, y, width, height);

          Bitmap img = new Bitmap (width, height);

          this.DrawToBitmap (img, bounds);
          Point p = new Point (5, 0);
          e.Graphics.DrawImage (img, p);
       }

       private void button1_Click_1 (object sender, EventArgs e)
       {
          button1.Hide ();
          PrintDocument pd = new PrintDocument ();
          pd.PrintPage += new PrintPageEventHandler (PrintImage);
          pd.Print ();
          button1.Visible=true;
       }

Please help.

ayha
C#.NET ProgrammingASP.NET

Avatar of undefined
Last Comment
ayha1999

8/22/2022 - Mon
nishant joshi

you can use this parameter to get full screen,

System.Windows.SystemParameters.PrimaryScreenWidth
System.Windows.SystemParameters.PrimaryScreenHeight
ASKER CERTIFIED SOLUTION
nishant joshi

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ayha1999

ASKER
can you give the full code and where to use it?

Thanks
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes