c# - Fit Label size to drawn text -
i'm using label display progress user. occurs many times , partly user-defined text changes every time.
problem: should know if drawn text bigger label's size.
i tried approach:
using (graphics g = lbl.creategraphics()) { sizef size = g.measurestring(lbl.text, lbl.font); // change size of label if small }
but slow , uses lot resources when calling @ every update.
so there way find out when drawn text bigger label?
edit:
stated hans passant, autosize
it.
sorry, didn't other controls below label has move then.
it seems there no other way it.
have use above solution:
using (graphics g = lbl.creategraphics()) { sizef size = g.measurestring(lbl.text, lbl.font); // change size of label if small }
Comments
Post a Comment