[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 357
  • Last Modified:

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
0
ayha1999
Asked:
ayha1999
  • 2
1 Solution
 
nishant joshiTechnology Development ConsultantCommented:
you can use this parameter to get full screen,

System.Windows.SystemParameters.PrimaryScreenWidth
System.Windows.SystemParameters.PrimaryScreenHeight
0
 
nishant joshiTechnology Development ConsultantCommented:
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
 
ayha1999Author Commented:
can you give the full code and where to use it?

Thanks
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now