Resize dialog to match markup content |
Post Reply |
Author | |
roan98dk
Groupie Joined: 13 February 2011 Status: Offline Points: 14 |
Post Options
Thanks(0)
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 |
|
markr
Senior Member Joined: 01 August 2004 Status: Offline Points: 443 |
Post Options
Thanks(0)
|
> 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? |
|
roan98dk
Groupie Joined: 13 February 2011 Status: Offline Points: 14 |
Post Options
Thanks(0)
|
Thanks, exactly what I was looking for
I had to lock markup width to match dialog static text width, but after that it works perfectly. |
|
markr
Senior Member Joined: 01 August 2004 Status: Offline Points: 443 |
Post Options
Thanks(0)
|
No problem, glad to help.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |