Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2010-11-22
4
Medium Priority
?
514 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 45

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 45

Accepted Solution

by:
AndyAinscow earned 2000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

971 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