Solved

Form and screen resolution

Posted on 2012-03-14
3
326 Views
Last Modified: 2012-06-21
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
0
Comment
Question by:ayha1999
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 14

Expert Comment

by:nishant joshi
ID: 37719477
you can use this parameter to get full screen,

System.Windows.SystemParameters.PrimaryScreenWidth
System.Windows.SystemParameters.PrimaryScreenHeight
0
 
LVL 14

Accepted Solution

by:
nishant joshi earned 250 total points
ID: 37719495
you have to use "Screen.PrimaryScreen.Bounds.Width" in place "System.Windows.SystemParameters.PrimaryScreenWidth" and ""Screen.PrimaryScreen.Bounds.Height" in place of "System.Windows.SystemParameters.PrimaryScreenHeight"


Regards,
nishant
0
 
LVL 7

Author Comment

by:ayha1999
ID: 37719498
can you give the full code and where to use it?

Thanks
0

Featured Post

Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question