Solved

Form and screen resolution

Posted on 2012-03-14
3
310 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
  • 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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

760 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now