Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » How to get the client size of a control bar Collapse All
Subject Author Date
Offer Har Dec 26, 2008 - 7:56 AM

Dear Support,


I have this piece of code:



    void CMyControlBar::Show()
    {
        CSize szDesiredSize;
        CPoint pt (0,0);
        SetInitDesiredSizeFloating(szDesiredSize);
        SetInitDesiredPosFloating(pt);
        FloatControlBar(pt);
        pMainFrm->RecalcLayout();
        pMainFrm->SendMessage(WM_NCPAINT); 
        pMainFrm->ShowControlBar(this, TRUE, FALSE);
    
        CSize sz = GetSizeFloating();
        CRect rc;
        GetClientRect(rc);
    }

My problem is that neither sz nor rc contain the real client area size.

How can I get the real client area size of a control bar?


Thanks,


Ron.


 

Technical Support Dec 29, 2008 - 8:11 AM

The GetClientRect() API returns the real size of window client area. Please provide us with more details about your task. What you have initially and what should be done?

Offer Har Dec 29, 2008 - 8:15 AM

What I get in the GetClientRect is 2 pixels bigger then the actual client rect. you can see the explanation in my attached screenshot + what happens to my inner control.


The thing is that I replace the control in a control-bar, and I have resize it, or else it does not resturcture itself internally. I resize it with the parameters in GetClientRect, which provides me the wrong size.

Offer Har Dec 26, 2008 - 10:30 AM

Here is an example of the problem I have. I have to resize my control inside the contol-bar, otherwise it does not re-position its internal structure correctly, so I call this line:



    m_pCtrl->SetWindowPos(NULL,0,0,rc.Width(), rc.Height(), SWP_NOZORDER|SWP_NOMOVE);


The problem can be shown in the picture below: