Print Page | Close Window

Resize dialog to match markup content

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: MarkupLabel Control
Forum Description: Topics Related to Codejock MarkupLabel Control
URL: http://forum.codejock.com/forum_posts.asp?TID=18701
Printed Date: 05 May 2024 at 5:25pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Resize dialog to match markup content
Posted By: roan98dk
Subject: Resize dialog to match markup content
Date Posted: 21 July 2011 at 12:12pm
I have a simple CXTPDialog with a single large CXTPMarkupContext area.

Is there a simple way to resize the dialog to fit the content of the CXTPMarkupContext area?

I have looked at the CXTPMarkupUIElement::GetDesiredSize() and similar methods but they do not return a size until the dialog is fully drawn. I try to resize in the OnInitDialog part of the dialog initialization, but perhaps that is the problem?

I am basically using the CMarkupStatic class from the MarkupSample in ToolkitPro v.15.0.2.

Regards
Ronnie



Replies:
Posted By: markr
Date Posted: 22 July 2011 at 9:23am
I have looked at the CXTPMarkupUIElement::GetDesiredSize() and similar methods but they do not return a size until the dialog is fully drawn...

Could you measure the markup directly, and then size the dialog accordingly? Something like this (error handling stripped for brevity):

CXTPMarkupContext* pContext = XTPMarkupCreateContext(0);
CXTPMarkupUIElement* pElement = pContext->Parse("Your markup here");
CSize sz = XTPMarkupMeasureElement(pElement);
pElement->Release();

Then set dialog size based upon markup dimensions?


Posted By: roan98dk
Date Posted: 22 July 2011 at 10:17am
Thanks, exactly what I was looking for Smile

I had to lock markup width to match dialog static text width, but after that it works perfectly.


Posted By: markr
Date Posted: 25 July 2011 at 10:11pm
No problem, glad to help.



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