Print Page | Close Window

HOWTO resize MarkupStatic / move other controls

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=17953
Printed Date: 19 June 2025 at 1:32pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: HOWTO resize MarkupStatic / move other controls
Posted By: mgampi
Subject: HOWTO resize MarkupStatic / move other controls
Date Posted: 24 February 2011 at 4:31am
Hi;

I created a CXTPResizeDialog derived class containing a CMarkupStatic control on top and immediately below the CMarkupStatic control a CXTPReportControl class.
Whenever the dialog is resized the content of the CMarkupStatic is partly invisible.
How can I ensure, that the size of the control is always big enough to show the whole content and how do I know the new position of the report control?

Here's a picture of what I mean:



Any help is very welcome...




-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022



Replies:
Posted By: mgampi
Date Posted: 25 February 2011 at 3:05am
Hello;

No solution for this? I can't believe it.


-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022


Posted By: cpede
Date Posted: 25 February 2011 at 5:43am
Well, if you just places controls on a Dialog or Form there is no build-in automatic moving and resizing of the individual controls, and Dialog and Form sizes etc.
 
If you want to have control, you can read the size of the Markup context object and then manually move your Report control up or down accordingly.
 
That is at least the way I do it.
 
-cpede


-------------
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)


Posted By: mgampi
Date Posted: 25 February 2011 at 5:52am
But how can I read the size of the Markup content. That's what I was looking for...

-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022


Posted By: cpede
Date Posted: 25 February 2011 at 5:58am
I use code like this:
 
 if (m_ctrl.GetSafeHwnd())
 {
   if (m_ctrl.GetUIElement())
   {
     CDC* pDC = m_ctrl.GetDC();
     if (pDC)
     {
        CSize sizeAvailable(rc.Width(),rc.Height());
        CXTPMarkupDrawingContext dc(pDC->m_hDC);
        m_ctrl.GetUIElement()->Measure(&dc,sizeAvailable);
        CSize sizeDesired = m_ctrl.GetUIElement()->GetDesiredSize();
        m_ctrl.ReleaseDC(pDC);
       
m_nHeight = sizeDesired.cy;
     }
   }
   m_ctrl.SetWindowPos(NULL,0,rc.Height()-m_nHeight,rc.Width(),m_nHeight,SWP_NOZORDER);
 }

I don't know if the code is optimal, but it works Smile
 
-cpede


-------------
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)


Posted By: mgampi
Date Posted: 25 February 2011 at 6:01am
Hi;

Thanks, that's what I was looking for!


-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022


Posted By: mgampi
Date Posted: 25 February 2011 at 6:40am
Hi;

I included the suggested code into my OnSize() message handler. But now the report control flickers while resizing. What can I do to prevent this?

Here's the code of my OnSize handler:
void CArticleParameterDlg::OnSize( UINT nType, int cx, int cy )
{
    CXTPResizeDialog::OnSize(nType, cx, cy);

    if (Static_.GetSafeHwnd() && Static_.GetUIElement()) {
        CDC* pDC = Static_.GetDC();
        if (pDC)
        {
            CXTPWindowRect rc(&Static_);
            CSize sizeAvailable(rc.Width(), cy);
            CXTPMarkupDrawingContext dc(pDC->m_hDC);
            Static_.GetUIElement()->Measure(&dc,sizeAvailable);
            CSize sizeDesired = Static_.GetUIElement()->GetDesiredSize();
            Static_.ReleaseDC(pDC);
            rc.bottom=rc.top+sizeAvailable.cy;

            int top=rc.top;
            ScreenToClient(&rc);
            Static_.MoveWindow(rc, FALSE);

            if (Report_.GetSafeHwnd()) {
                CXTPWindowRect rcReport(&Report_);
                rcReport.top=top+sizeDesired.cy+10;
                ScreenToClient(&rcReport);
                Report_.MoveWindow(rcReport, FALSE);
            }
        }
    }

}



-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022


Posted By: cpede
Date Posted: 25 February 2011 at 6:56am
You probable need to play with the WS_CLIPCHILDREN and WS_CLIPSIBLINGS styles on your Dialog or Form and control.
 
And if owner draw, then remember to return correctly in the OnEraseBkgnd(CDC* pDC) method.
 
-cpede


-------------
Product: Xtreme ToolkitPro (24.0.0)
Platform: Windows 10 (x64)
Language: Visual Studio 2017 (C++)


Posted By: mgampi
Date Posted: 25 February 2011 at 7:12am
Hi;

I think it's because of using a CXTPResizeDialog. The CLIP* styles are all set as expected. When I remove my additional code from OnSize() the flicker goes away.
Perhaps Oleg has an idea how to integrate this resize into the CXTPResize() concept.

Nevertheless, thanks for your help.


-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022


Posted By: Oleg
Date Posted: 25 February 2011 at 8:31am
Hi,
if you manually position controls, just don't use CXTPResize


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: mgampi
Date Posted: 25 February 2011 at 8:51am
Thanks Oleg! Thumbs Up

Now it works like a charm...



-------------
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net