Re: How to specify the exact size and location of a control in a d
 
"Kueishiong Tu" <KueishiongTu@discussions.microsoft.com> wrote in message 
news:A16CE931-0C5F-4145-9314-7B9D818DBF01@microsoft.com...
You can use code in OnInitDialog to reposition controls in exact units of
pixels at the screen's current resolution. Call the control's MoveWindow 
or
SetWindowPos.
Dear Scott:
Can you be more specific? For example if I have a Edit control on a 
dialog,
how do I get access to the edit control and call its member function to 
set
its size and location.
Right-click on the edit control in the resource editor.  Select 'Add 
Variable'.  Fill in a variable name of type CEdit, like m_MyEditControl.
Then in the dialog's OnInitDialog method, do this:
BOOL CMyDlg::OnInitDialog()
{
 CDialog::OnInitDialog();
 m_MyEditControl.MoveWindow(x, y, width, height); // coordinates in pixels
Now we must ask: Why do you want to do this?  You don't have any control 
over the screen resolution or the font size that the user may have set up as 
the default, so unless you do a lot more work your edit control will be 
poorly placed and sized for many users.  That's why the resource editor only 
works in 'dialog units.'  If you think you can resize things just the way 
you want, you are probably not aware of how much difference there can be in 
screen measurements from computer to computer.
-- 
Scott McPhillips [VC++ MVP]