On 17 July 2008, Sean Healy wrote: > > ($x, $y) = $Label->GetTextExtentPoint32($string);
Upon further experimentation, there is something not quite right with that. The width it returns is too wide. There seems to be some sort of per-character skew -- short strings are very accurate; longer strings get progressively worse. Here is a sample program to demonstrate the problem. I have attached a screenshot of the resulting output. use strict; use warnings; use Win32::GUI(); my $main = Win32::GUI::Window->new (-name => 'Main', -width => 300, -height => 150); my $top = 0; for my $str ('', 'A', 'AAAAA', 'This is a test') { # Demonstrate the width as computed my $demo = $main->AddLabel(-text => 'dummy', -top => $top, -left => 150, -background => 0xFF80FF); my ($w, $h) = $demo->GetTextExtentPoint32($str); $demo->Text($str); $demo->Width($w); # Label the demo output my $info = $main->AddLabel(-text => "'$str' => w=$w", -top => $top, -left => 0); $top += $info->Height; } $main->Show; Win32::GUI::Dialog; exit; sub Main_Terminate { -1; } Why do the longer fields have a large error in the computed width? Thanks, Eric
<<attachment: perlgui.png>>
------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________ Perl-Win32-GUI-Users mailing list Perl-Win32-GUI-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users http://perl-win32-gui.sourceforge.net/