Adjust ActivityDesigner size to text size

Hi.

I have a CustomActivityDesigner class (inheriting from ActivityDesigner). This designer is attached to several Activities and renders a uniform layout for each.

However, I would like to control the size of the designer layout (Size Property) according to the size/font of a text I'm rendering on the designer surface 'title'. The text will be taken from the attached Activity's name (or similar).

My question:

In order to mesaure the size of the text I'm rendering I need to use Graphics.MeasureString(). However, Graphics is available only in the OnPaint method, which seems like a too late stage to set the designer's Size.

Any ideas?

[696 byte] By [Mulick] at [2008-1-4]

Software Development for Windows Vista

Site Classified