Bart Broersma mentioned this to All:
BB> However, this will give a wrong result, if SomeObject has not actually
BB> been drawn yet with the applied Font. So, the first time I do
BB> SomeObject.Show, the results are different from subsequent times.
However,
BB> I need to know get the right numbers before I do the actual drawing in
the
BB> applied Font, so I can calculate the size that SomeObject will have to
e
BB> ... (get my drift ??).
Why not calculate them when you actually do the drawing? The reason the
results are different is that a canvas doesn't actually get a display context
assigned to it until it needs to. And it only needs to when it's about to
start painting.
If you really have to know in advance, you could post (with PostMessage) a
custom message to your form from the FormShow event. By the time the form
gets around to handling your custom message, the form would be painted, thus
allowing you to refer to the canvas correctly.
...Gary
--- GoldED 2.41
---------------
* Origin: The Flying Circus BBS, Farmington Hills, MI. (1:2410/905)
|