Solved

Dialog Controls not drawing with correct aspect ratio in Visual Studio 6.0 C++:

Posted on 2010-11-22
4
497 Views
Last Modified: 2012-05-10
I'm using VC6.0.  When I put some controls on a dialog (such as buttons, listboxes, etc), I want them to be square in shape.  For example, 40 x 40.  While using the resource editor, in the very bottom right corner of Visual Studio, the size of my selected controls displays.  But even when the numbers say 40 x 40, the control itself draws as a rectangle, being taller than it is wide.  This even happens in design time. So the control that I want to be 40 x 40 is drawn as if it's actually about 30 x 40.

Any idea why this occurs, or how to fix this (other than simply figuring out the "scale" and adjusting the size of my controls accordingly?

Thanks a bunch.
0
Comment
Question by:cjm20
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 34191353
You talk about during design - when the app runs is it OK ?
0
 

Author Comment

by:cjm20
ID: 34191400

No.  Same issue at run time.  The controls are drawn taller than they are wide.  This happens on numerous monitors, btw.
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 500 total points
ID: 34205729
I suspect you are running into  a problem that the dialog editor doesn't use pixels but an arbitrary unit based on the average width and height of characters in the font the dialog is using.

For  more info look at GetDialogBaseUnit and MapDialogRect in the help files.

If they do need to be square you might have to resize them at runtime - look at SetWindowPos and MoveWindow in help.  (I like SetWindowPos because the flags allow you to just resize it without moving it if that is all you require).
0
 

Author Comment

by:cjm20
ID: 34258420
You are correct.  Ultimately resizing at runtime is what I've settled upon.   It's too bad (at the least VC6.0) can't use a 1:1 aspect ratio for controls in its resource editor.  You'd think that would be the most intuitive way to go about it.  Oh well.  Thanks for the help.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
In Easy String Encryption Using CryptoAPI in C++ (http://www.experts-exchange.com/viewArticle.jsp?aid=1193) I described how to encrypt text and recommended that the encrypted text be stored as a series of hexadecimal digits -- because cyphertext may…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question