Solved

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

Posted on 2010-11-22
4
490 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
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AVI wait icons for CAnimateCtrl in Visual Studio 2008 MFC 1 151
Find Visual Studio Tools 2 111
Socket Programming (Unix) 8 140
computer science syllabus 3 88
Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
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 be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

809 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