I am developing a .NET CF based Graphics Application, my project involves a lot of drawing images, We have decided to go for porting the application on different handset resolution.(240 X 240 , 480 X 640) etc.
How would i go onto achieve this within single solution/project?
Is there a need to create different projects based on resolutions? How would i handle common files? and i need the changes in one of the common classes to occur across all devices.
Thank you, Cronos
Don’t listen to that idiot MusiGenesis. A much better way of handling different screen resolutions for Windows Mobile devices is to use forms inheritance, which can be tacked onto an existing CF application with minimal effort.
Basically, you design each form for a standard 240×320 screen. When you need to re-arrange a form for a new resolution (let’s say 240×240), you add a new form to your project and have it inherit from your original 240×320 form:
instead of just Form:
like usual. On your original form, you need to set the Modifiers property of each control to Protected (instead of the default Private). In the designer for your new form, you will see all of the controls on the form you’re inheriting from, and you can move them and resize them as you see fit to accomodate the new screen dimensions (this will not affect the original form’s layout).
When your program is running, it’s easy for it to check the screen resolution of the device it’s running on and create the appropriate form (a factory method is good for this). Your new form inherits everything from the old form, but uses your new custom layout.
This approach allows you to avoid code duplication, because there isn’t any.