Locking components to frames (anchors)

This is perhaps a stupid question.
In Borland Builder it is quite easy to 'anchor' a component to the border of a frame, but I can not find a way to do it in VC6!

I have a CFormView that contains a CListBox. When I resize the view, the ListBox are anchored to the left and top border.. What shall I do to anchor it to another border - ie the right or bottom.
TricksterAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RAVIDCommented:
hi,
map the OnSize of it and add the following code:-
CRect rect;
m_ListBox.GetWindowRect&rect);
ScreenToClient(&rect);      
m_ListBox.SetWindowPos(here specify  co-ordinates as u desire);

hope this helps,

cheers
0
RAVIDCommented:
hey sorry map the WM_SIZE and try it
0
TricksterAuthor Commented:
Could you please give me an example of SetWindowPos parameters in the above code?
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

TricksterAuthor Commented:
I tried using the above code, but got an 'DEBUG ASSERTION' on the line:

m_ListBox.GetWindowRect(&rect)

Any ideas?
0
RAVIDCommented:
hi,
sorry for that try this out.
if(m_ListBox.m_hWnd)
{
m_ListBox.GetWindowRect&theRect);
ScreenToClient(&theRect);
m_ListBox.SetWindowPos(&m_ListBox.wndTop,10,theRect.top,cx-30,cy-25,SWP_SHOWWINDOW |SWP_NOZORDER);
}      

In SetWindowPos I am using wndTop u can use which ever is useful for u

hope this helps

cheers
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
TricksterAuthor Commented:
That worked perfectly. You helped me understand how it works..

Thanks a lot!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.