Question

i'm developping an application in CF 3.5 for windows Mobile 6 Pro using C# and i have a little issue requiring the advice of someone that knows better.

Basically, i want my application to run and scale on multiple device sizes and resolutions. Eveything scales properly but the images. Some images that are for example 16X16 will look very small on a high resolution screen, so I want to display a 32X32 image, but I don't know what's the best way to decide which image size to display.

I have the option to check the dpi and then manually choose which image to display, but it seems like dirty work.

Isn't there any way to do it otherwise or what's the best way to do it?

Was it helpful?

Solution

I recommend that you create a layer between your forms and the images. Create a new class that would be responsible for returning the correct sized image. The code in your forms will rely on that to get the image and would have to know nothing about the sizes. For example:

mypicturebox.Image = ImageFactory.Image01;

The good thing is that you can use any technique you want inside the ImageFactory without affecting the rest of the code. The easiest thing to do is to check the size of the screen (using Screen.PrimaryScreen.WorkingArea) and do a manual decision.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top