Versions des environnements
>>Bottom line: When it comes to measuring string lengths, is yours
>>more likely to provide a more accurate result than
>>GdipMeasureString?
>
>GDI+'s GdipMeasureString is the most precise, device independent way of accuratly measuring a string's width and height...
>
>...UNLESS you need to know exactly, to the pixel, how wide and tall a string was rendered using the older GDI graphics engine. Only the older GDI engine can tell you that.
>
>Think of it like an odometer in 2 different cars and measuring distance between 2 points...
>
>Car (A) has no 1/10th indicator on its odometer. Everytime it stops at a stop sign or traffic light it writes down it's milage (to +/-1.0 acurracy) and resets the odomter. When it finishes it's trip it adds all the numbers together to get the total distance traveled.
>
>Car (B) has a 1/10th indicator on its odometer and it doesn't reset its odomoter. It just keeps it running from the beginning of the trip to the end.
>
>Both of these cars could measure close to the same distance. But the more stops you have, the farther off the measurment will be.
>
>Car (A) is like GDI. It uses integers and calculates the character width of each letter and rounds it to the nearest pixel then adds the integers up sequentially. Car (B) is like GDI+, it uses floating point numbers and doesn't round off the character width. It is a more accurate way of measuring, but will never be exactly the same as GDI.
>
>I hope this helps.
Thanks for the feedback, Bo. I've found that GdipMeasureString can be off
by several percent in some scenarios, even when taking care to
minimize round-off errors. I guess I'll just have to continue to
fudge-factor it.
-m.
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement