CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2006
    Posts
    216

    How to use resolution independent unit?

    Take any winform control. As an example, suppose there is a button named btn1. If I write
    btn1.Width = 150;

    then the Width of betn1 becomes 150 pixels.
    But, for all controls in a given winform, I do not want to use pixel as unit. Rather I want to use some unit, which does not depend on resolution, e.g, milimeter.
    How do I do that?

  2. #2
    Join Date
    Jun 2008
    Posts
    2,477

    Re: How to use resolution independent unit?

    You could get the current resolution and use the ratio of that to your optimum res. as a scale factor, but I have never found the need. If you don't make things overly large you should be fine. The smallest common resolution these days is something like 1024x768 (I am probably off a little, but it is close.) Just program to meet that requirement and you should be fine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured