Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Form and screen resolution

Posted on 2012-03-14
3
Medium Priority
?
352 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 1000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

636 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