CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 1999
    Posts
    5

    Solution to make project resolution independent


    Hi,

    This is one common problem with all VC++ projects.
    Make a project in some resolution. compile the rc file and run the exe..

    It runs fine and shows all the resources of proper size. But now if we cahnge the
    resolution of the system, all screens are distorted.

    If anyone knows the solution of this problem, pleae help me out. I am facing this problem.

    Regards,
    Rakesh Verma

    Rakesh Verma
    SSI, New Delhi
    [email protected]

  2. #2
    Join Date
    May 1999
    Posts
    12

    Re: Solution to make project resolution independent

    You'll have to code for this to happen. There are functions like MoveWindow that moves the window to a position specified by you. You also have GetSystemMetrics function that will give you the present resolution of the screen. If you go to the resource editor you'll have the dimensions of the resource in pixels. You'll have to derive a conversion formula and use MoveWindow Later.
    I hope this helps



  3. #3
    Join Date
    May 1999
    Posts
    116

    Re: Solution to make project resolution independent

    You also need to be aware of the font being used.
    When changing between resolutions, the controls stay the same size (as regards pixels), but look bigger/smaller cause the size of a pixel is bigger/smaller. However, when you switch font size (between small & large fonts in Display Settings) window actually increases/decreases the size of the control to sute the font.
    So when moving / resizing controls with MoveWindow be sure to test on differnet font size as well.


  4. #4
    Join Date
    Apr 1999
    Posts
    5

    Re: Solution to make project resolution independent

    Hi,
    Thanks for your response.

    Does this means that I have to call MoveWindow for all controls on a dialog etc.


    Regards,
    Rakesh

    Rakesh Verma
    SSI, New Delhi
    [email protected]

  5. #5
    Join Date
    May 1999
    Posts
    116

    Re: Solution to make project resolution independent

    Well for a normal dialog, you shouldnt have to move any controls (unless you want to support resizing). Instead, design the dialog to fit on the screen while running 640x480 with large fonts and it should be fine for anytning.


  6. #6
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Solution to make project resolution independent

    The only time you need to move controls is if the dialog is resizeable (and there is code in www.codeguru.com that automatically moves your controls for resizeable dialogs).

    A dialog positions the controls in dialog units, not pixels. This is why child controls of a dialog will always show up proportionately in the right places, regardless of the resolution. (You are using a dialog box, and not a "real" window, right?)

    Always develop the dialogs in the lowest resolution possible (640x480). This will keep you in touch with how your screen management looks for every monitor.

    Regards,

    Paul McKenzie


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