Form Size and Screen.Bounds

D

dadawan

I am using VS2005 to create C# apps using the compact framework.

My problem is that I make a form that is 640x480 pixels, but...

When I run it in the Pocket PC VGA emulator, the form is way too big
and shows up with scroll bars. If I display Screen.Bounds is says the
screen is 320x200. That is incorrect.

The same thing happens when I run it on a Dell Axiam pocket pc.
Form is stretched, wrong screen size reported.

I have played with the Font Size and also the AutoScaleMode property,
and nothing seems to make a difference.

When I created the project, I chose Visual C#.SmartDevice.Windows CE
5.0 as the template. Is the 320x200 a result of that choice? If so
what can I do to change the screen size to 640x480 to match the
emulator?

Thanks for any help with this.

-Kevin
 
P

Paul G. Tobey [eMVP]

As you might expect, even if the screen is VGA, the device does things so
that applications designed for ordinary Pocket PC will look the same on the
VGA device. Unless you are marked as knowing about resolutions, you will
get what appears to be a 320x240 display where the pixels are doubled
automatically underneath you.

Here's a thread that I found in a couple of seconds that talks about some
things:

http://groups.google.com/group/micr...tion+aware+mark&rnum=3&hl=en#aa4773d7d3ce7824

Paul T.
 
D

dadawan

However, my app still shows up magnified by two, and the
Screen.Bounds still reports 320x240.

I notice that when I hit Start Debugging to run on the emulator it
overwrites my debug.exe so no doubt it is overwriting any change made
by res2exe

-Kevin
 
P

Paul G. Tobey [eMVP]

You probably want to modify the output EXE *as part of the build process*,
so it's always done. I'm afraid that you've gotten everything out of my
head on this topic...I don't target Pocket PC devices.

Paul T.
 
K

Kevin S.

Paul said:
You probably want to modify the output EXE *as part of the build process*,
so it's always done. I'm afraid that you've gotten everything out of my
head on this topic...I don't target Pocket PC devices.

Paul T.

However, my app still shows up magnified by two, and the
Screen.Bounds still reports 320x240.

I notice that when I hit Start Debugging to run on the emulator it
overwrites my debug.exe so no doubt it is overwriting any change made
by res2exe

-Kevin

Paul G. Tobey [eMVP] wrote:
As you might expect, even if the screen is VGA, the device does things
so
that applications designed for ordinary Pocket PC will look the same on
the
VGA device. Unless you are marked as knowing about resolutions, you
will
get what appears to be a 320x240 display where the pixels are doubled
automatically underneath you.

Here's a thread that I found in a couple of seconds that talks about
some
things:

http://groups.google.com/group/micr...tion+aware+mark&rnum=3&hl=en#aa4773d7d3ce7824

Paul T.

I am using VS2005 to create C# apps using the compact framework.

My problem is that I make a form that is 640x480 pixels, but...

When I run it in the Pocket PC VGA emulator, the form is way too big
and shows up with scroll bars. If I display Screen.Bounds is says
the
screen is 320x200. That is incorrect.

The same thing happens when I run it on a Dell Axiam pocket pc.
Form is stretched, wrong screen size reported.

I have played with the Font Size and also the AutoScaleMode
property,
and nothing seems to make a difference.

When I created the project, I chose Visual C#.SmartDevice.Windows
CE
5.0 as the template. Is the 320x200 a result of that choice? If so
what can I do to change the screen size to 640x480 to match the
emulator?

Thanks for any help with this.

-Kevin
 
K

Kevin S.

For those who are trying to make a 640x480 compact framework app for
the Pocket PC, and are having trouble because the form is showing
magnified by 2, here is what I have found that works:

I guess that Microsoft assumes that all .net apps for the pocket PC
are 320x240, and will stretch your form to 640x480 (on Hi Res devices)
so it fills the screen. But for some reason they did not make it
smart enough to notice that a form is already 640x480, so it magnifies
your form up to 1280x960 and puts scroll bars up so you can scroll
around looking for buttons. :(

I have not yet found a good solution, but can at least get my forms
to display properly while not debugging.

Microsoft's page regarding the issue:
http://msdn2.microsoft.com/en-us/library/ms838174.aspx

I'm using WinCE 5.0

I have AutoScaleMode set to None, form is 640x480 size, and
WindowState Maximized.

I build the app, then I must run the following command:

res2exe -c -r hidpi.res YourApp.exe

You can find this .exe and the .res file on your system. They are in
different places; I found them with Search.

This will make your app 'Dpi Aware' and stops the magnification.

The bad news is that when I press 'Start Debugging' in hte VS ide, it
overwrites my .EXE before deploying, so that I cannot debug the app
with it also being DPI Aware.

So these are the steps I go through:

1.) I use 'Start Debugging' from VS to start up the Pocket PC Emulator
2.) After it boots, I go to Settings->System->Screen and change to
landscape.
3.) Wait for it to install Compact Framework 2.0 and start the
magnified app.
4.) Close the app
5.) res2exe -c -r hidpi.res YourApp.exe
6.) Go to the Start-Program Files->Visual Studio->Visual Studio Remote
Tools->Remove File Viewer
7.) Open VGA Emulator
8.) Navigate on the viewer to the folder Program Files\YourApp and
choose the YourApp.exe file that you had modified with the res2exe
program in step 5.
9.) Choose File:Export and browse to
10.) Back on the emulator, start up Program Files->File Explorer.
Navigate to Program Files\YourApp folder, and click on the program.
11.) It should now run in 640x480 and be displayed normally.

I would hope there is a better way, but for now this will work.

I can't understand why Microsoft went to all the trouble to make a
640x480 emulator, but did not adress of the issue of the unwanted form
magnification. Why did I have to spend a day reading forums and doing
google searchs to fix something that everybody who tries to make a .net
app to run in 640x480 will run into?

But many thanks to Paul T. for getting me pointed in the right
direction.

-Kevin S.


You probably want to modify the output EXE *as part of the build process*,
so it's always done. I'm afraid that you've gotten everything out of my
head on this topic...I don't target Pocket PC devices.

Paul T.

However, my app still shows up magnified by two, and the
Screen.Bounds still reports 320x240.

I notice that when I hit Start Debugging to run on the emulator it
overwrites my debug.exe so no doubt it is overwriting any change made
by res2exe

-Kevin

Paul G. Tobey [eMVP] wrote:
As you might expect, even if the screen is VGA, the device does things
so
that applications designed for ordinary Pocket PC will look the same on
the
VGA device. Unless you are marked as knowing about resolutions, you
will
get what appears to be a 320x240 display where the pixels are doubled
automatically underneath you.

Here's a thread that I found in a couple of seconds that talks about
some
things:

http://groups.google.com/group/micr...tion+aware+mark&rnum=3&hl=en#aa4773d7d3ce7824

Paul T.

I am using VS2005 to create C# apps using the compact framework.

My problem is that I make a form that is 640x480 pixels, but...

When I run it in the Pocket PC VGA emulator, the form is way too big
and shows up with scroll bars. If I display Screen.Bounds is says
the
screen is 320x200. That is incorrect.

The same thing happens when I run it on a Dell Axiam pocket pc.
Form is stretched, wrong screen size reported.

I have played with the Font Size and also the AutoScaleMode
property,
and nothing seems to make a difference.

When I created the project, I chose Visual C#.SmartDevice.Windows
CE
5.0 as the template. Is the 320x200 a result of that choice? If so
what can I do to change the screen size to 640x480 to match the
emulator?

Thanks for any help with this.

-Kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top