Solved

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

Posted on 2010-11-22
4
474 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
Comment Utility
You talk about during design - when the app runs is it OK ?
0
 

Author Comment

by:cjm20
Comment Utility

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
Comment Utility
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
Comment Utility
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
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.

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now