How to determine PDA resolution (DPI) in .Net compact framework 1.

G

Guest

Hi Friends,
Can anybody help me how to determine resolution of Pocket pc
5.0 with a program developed in .Net compact framework?

Thanks,
-Santosh
 
G

Guest

Thanks Paul. Is any win32 APIs through which we can know screen resolution I
mean wheather PDA is 240X320 or 480X640?

Thanks,
-Santosh
 
P

Peter Foot [MVP]

System.Windows.Forms.Screen.PrimaryScreen.WorkingArea will return the screen
area. However if your app is not marked as hi-dpi aware this will return
240x320 even on a hi-dpi device because it will function in compatibility
mode (using pixel doubling)

Peter
 
G

Guest

Thanks a lot Peter pointing me there but sorry to mention that I am
developing application using .NetCF 1.0 and APIs is not supported there.

I read MSDN article that .Net compact framework automatically resize the
controls on .NET Compact Framework forms to take advantage of high-dpi
displays.

My requiremnt is that I want this default behaviour but I am using a bitmap
for my application home screen. I want to display different bitmap for
resolutions '240 X 320' and '480 X 640'. What I am thinking that if I can
determine the resolution at run time then I can read corresponding bitmap
from resource file. Please correct me if my thinking is going wrong
somewhere.
I am just strugging for Win32API or .Net CF1.0 API that gives me resolution
at run time.

Can you please help me out?
Thanks,
-Santosh
 
S

Simon Hart

Santosh,

Implementing your application as DPI aware on CF 1.0 is very difficult (this
means targetting QVGA and VGA devices) and in my opionion not worth the
effort.

You should try upgrading to CF 2.0, it handles DPI-aware automatically and
enables you to get runtime DPI easily so you can draw different bitmaps,
icons etc at runtime.

Regards
Simon.
 
G

Guest

Thanks Simon. The issue is that Windows Mobile 5.0 has .Net CF1.0 in ROM not
the .NetCF2.0. To distribute .NetCF2.0 application we have to install .Net CF
2.0 cab file that my product team don't want since we will do GPRS update and
that will cost to customer.

Can you please help me what I have to do so that .Net CF1.0 will be DPI aware?

Thanks a lot

Cheers,
-Santosh
 
G

Guest

Just a quick question. I assume that hidpi.res is my resource file containing
all my hidpi icons/images. Where can i get tool RES2EXE for Visual Studio
2005?

Thanks,
-Santosh
 
D

DJMatty

Hi

I've seen that people have replied, but this is something that we have
had to do in our unmanaged app recently, and to get the screen
dimensions and DPI we use these calls:

int iHeight = GetSystemMetrics(SM_CYSCREEN);
int iWidth = GetSystemMetrics(SM_CXSCREEN);

int iPixels = GetDeviceCaps( GetDC()->m_hDC, LOGPIXELSX );

if iPixels is 96 it's low dpi...

HTH

Matt
 
G

Guest

Thanks Matt.

Cheers,
-Santosh

DJMatty said:
Hi

I've seen that people have replied, but this is something that we have
had to do in our unmanaged app recently, and to get the screen
dimensions and DPI we use these calls:

int iHeight = GetSystemMetrics(SM_CYSCREEN);
int iWidth = GetSystemMetrics(SM_CXSCREEN);

int iPixels = GetDeviceCaps( GetDC()->m_hDC, LOGPIXELSX );

if iPixels is 96 it's low dpi...

HTH

Matt
 

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