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?

[Webinar] Streamline your web hosting managementRegister Today

x
 
RAVIDConnect With a Mentor Commented:
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
 
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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
TricksterAuthor Commented:
Could you please give me an example of SetWindowPos parameters in the above code?
0
 
TricksterAuthor Commented:
I tried using the above code, but got an 'DEBUG ASSERTION' on the line:

m_ListBox.GetWindowRect(&rect)

Any ideas?
0
 
TricksterAuthor Commented:
That worked perfectly. You helped me understand how it works..

Thanks a lot!
0
All Courses

From novice to tech pro — start learning today.