Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I am starting a mini-project in c# which simulates a moving LED display.
I would like some suggestion on how to handle the resolution across various systems.

When the application runs under different resolutions the form size changes and hence the drawing position also changes.

As i am new to graphics programming and moderate knowledge of c#,
i would really appreciate any suggestions.
Posted

The most important issue is to use floating point numbers internally and apply rounding just before drawing. Internally you can then scale very easily by multiplying with some calculated screen ratio. If you created your application for 800x600 and now running on 1920x1080 you would do:

horizontal multiplier = (1920 / 800) = 2.4
vertical multiplier = (1080 / 600) = 1,8

When you multiply every value on the x axis by 2.4 and every value on the y axis by 1.8 you scale to the new resolution. You can simply check this by simply assume you draw from (0,0) to (800,600) and when multiplying both you will get (0,0) to (1920, 1080).

As mentioned you need to separate internal calculation and drawing and thats it. You can the also easily apply other kind of effects rather easy, like rotation for example.

Good luck!
 
Share this answer
 
Comments
Toli Cuturicu 23-Sep-10 18:31pm    
!
I tried ur suggestion and it worked ok.I created 2 scale factors then
applied it to all the elements including graphics and controls.
Thanks, it really helped.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900