S
scottelloco
Hi,
I'm developing a CF application to run on VGA and QVGA devices with
both 240x320 and 240x240 screens. I have everything working fine on
both screen sizes in QVGA mode, but VGA is giving me some problems.
I'm trying to write as little code as possible to accommodate for all
of these variables. I'm using VS 2005, C#, CF 2.0 and the VS 2005 VGA
emulator for testing (unfortunately I don't have a real VGA device to
determine if this is an issue with the emulator.)
I have a form with one textbox and two buttons (code below.) I
calculate the size of the of the textbox based on the right and bottom
bounds of the WorkignArea of the screen. In VGA mode when AutoScale
mode is set to dpi and AutoScaleDimensions is (96F, 96F) the textbox
huge and flows way off of the screen. The buttons size are static and
are the correct relative size in this scenario.
When I during off AutoScale then my textbox fits on the screen, since
the sizing is dynamic based on the WorkingArea parameters, but the
buttons are a quarter of the size they should be (as I would expect)
since their size is static.
Code:
this.AutoScaleDimensions = new System.Drawing.SizeF(96F,
96F);
this.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Dpi;
int gScreenTop =
System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Top;
int gScreenBottom =
System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Bottom;
int gScreenLeft =
System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Left;
int gScreenRight =
System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Right;
//
// btnSync
//
this.btnSync.Size = new System.Drawing.Size(93, 21);
this.btnSync.Location = new
System.Drawing.Point((gScreenRight / 2) + 13, gScreenBottom - 80);
//
// btnCancel
//
this.btnCancel.Size = new System.Drawing.Size(93, 21);
this.btnCancel.Location = new
System.Drawing.Point(((gScreenRight / 2) - (btnCancel.Size.Width)) +
11, gScreenBottom - 80);
//
// txtStatus
//
frmSync.txtStatus.Location = new System.Drawing.Point(10,
10);
frmSync.txtStatus.Size = new
System.Drawing.Size(gScreenRight - 20, gScreenBottom - 100);
When on a VGA device, gScreenBottom = 640 and gScreenRight = 480. I
center the buttons by dividing the ScreenWidth by 2 and then taking
into account the size of the buttons, I then add a little buffer space
between the buttons.
In QVGA this technique works fine, but in VGA it seems to think that
the right bound (640) is way off to the right of the actual visible
screen and that the bottom bound (480) is way off the bottom of the
visible screen, so my buttons end up somewhere way down in never-never
land.
The same thing for the textbox. It overflows way past the end of the
screen when AutoScale is on. However when Autoscale is off the textbox
fits correctly on the screen (except as I mentioned and as I would
expect the button are a 1/4 of the size they should be, since their
size is static.)
Another thing that seems weird is that when AutoScale is true, the
WorkingArea.Top = 52 (the height of the top menu bar), but when
AutoScale is false WorkingArea.Top = 26. Should it always be 26 since
AutoScale should adjust for VGA mode?
Any assistance or links to information would be greatly appreciated.
I've searched around a read a good deal about developing for VGA and
QVGA devices, but this has me stumped.
Thanks, -Scott
I'm developing a CF application to run on VGA and QVGA devices with
both 240x320 and 240x240 screens. I have everything working fine on
both screen sizes in QVGA mode, but VGA is giving me some problems.
I'm trying to write as little code as possible to accommodate for all
of these variables. I'm using VS 2005, C#, CF 2.0 and the VS 2005 VGA
emulator for testing (unfortunately I don't have a real VGA device to
determine if this is an issue with the emulator.)
I have a form with one textbox and two buttons (code below.) I
calculate the size of the of the textbox based on the right and bottom
bounds of the WorkignArea of the screen. In VGA mode when AutoScale
mode is set to dpi and AutoScaleDimensions is (96F, 96F) the textbox
huge and flows way off of the screen. The buttons size are static and
are the correct relative size in this scenario.
When I during off AutoScale then my textbox fits on the screen, since
the sizing is dynamic based on the WorkingArea parameters, but the
buttons are a quarter of the size they should be (as I would expect)
since their size is static.
Code:
this.AutoScaleDimensions = new System.Drawing.SizeF(96F,
96F);
this.AutoScaleMode =
System.Windows.Forms.AutoScaleMode.Dpi;
int gScreenTop =
System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Top;
int gScreenBottom =
System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Bottom;
int gScreenLeft =
System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Left;
int gScreenRight =
System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Right;
//
// btnSync
//
this.btnSync.Size = new System.Drawing.Size(93, 21);
this.btnSync.Location = new
System.Drawing.Point((gScreenRight / 2) + 13, gScreenBottom - 80);
//
// btnCancel
//
this.btnCancel.Size = new System.Drawing.Size(93, 21);
this.btnCancel.Location = new
System.Drawing.Point(((gScreenRight / 2) - (btnCancel.Size.Width)) +
11, gScreenBottom - 80);
//
// txtStatus
//
frmSync.txtStatus.Location = new System.Drawing.Point(10,
10);
frmSync.txtStatus.Size = new
System.Drawing.Size(gScreenRight - 20, gScreenBottom - 100);
When on a VGA device, gScreenBottom = 640 and gScreenRight = 480. I
center the buttons by dividing the ScreenWidth by 2 and then taking
into account the size of the buttons, I then add a little buffer space
between the buttons.
In QVGA this technique works fine, but in VGA it seems to think that
the right bound (640) is way off to the right of the actual visible
screen and that the bottom bound (480) is way off the bottom of the
visible screen, so my buttons end up somewhere way down in never-never
land.
The same thing for the textbox. It overflows way past the end of the
screen when AutoScale is on. However when Autoscale is off the textbox
fits correctly on the screen (except as I mentioned and as I would
expect the button are a 1/4 of the size they should be, since their
size is static.)
Another thing that seems weird is that when AutoScale is true, the
WorkingArea.Top = 52 (the height of the top menu bar), but when
AutoScale is false WorkingArea.Top = 26. Should it always be 26 since
AutoScale should adjust for VGA mode?
Any assistance or links to information would be greatly appreciated.
I've searched around a read a good deal about developing for VGA and
QVGA devices, but this has me stumped.
Thanks, -Scott