Measure a string

  • Thread starter Thread starter pnp
  • Start date Start date
P

pnp

Hi all,

Is there a way to get a strings' width without using the
Graphics.MeasureString() Method?

Thanks in advance,
Peter.
 
Hi,

Why do you want another way? The size of a string is only applicable when
drawing.

Chris
 
Because pending on the string size a label will be resized to fit it inside
and then a form will be resized to fit the label (and reorder other
controls). The problem is that call the MeasureString() only when the form
is Painted (OnPaint) so the form and it's contents can be seen while
resizing....

Is there a way to reorder and resize the form before it is shown?

Peter.
 
From what I understand you are experiencing flicker when drawing.
Have a look at the SetStyle() method of the Control class, it allows you to
enable double buffering and specify drawing options.

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top