Now that we are almost on the subject of Color. Can anyone tell me how to
set fore and back colors for a font? I can't figure out the color numbering
scheme.
Thanks,
Phil Larson
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Aldo Calpini
> Sent: Wednesday, March 03, 1999 12:52 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [perl-win32-gui] fontfaces in controls
>
>
> Sundar Raman wrote:
> >i'm trying to change the face of the font in a listbox control
> in order for
> it
> >to be a fixed width font so that i can display some data
> "properly". i've
> tried
> >$lstBox->ChooseFont(), which brings up the font choice box, but then what
> do i
> >trap for the font name and size and stuff? i see SetFont() and
> GetFont(),
> but
> >i'm not sure what they return or set.
> >
> >i tried $lstList->SetFont($lstList->ChooseFont());
> >
> >but this seems to always set the font face to system, bold!
>
> you should use a Win32::GUI::Font object for this.
> eg.
>
> $MyFont = new Win32::GUI::Font(
> -name => "Courier New",
> -height => 16,
> );
>
> and then
>
> $lstList = new Win32::GUI::Listbox(
> -font => $MyFont,
> # etc. etc.
> );
>
> or
>
> $lstList->SetFont($MyFont);
>
> of course, you can also use:
>
> $MyFont = new Win32::GUI::Font(Win32::GUI::ChooseFont());
>
> but I've seen that ChooseFont seems to interpet font heights
> differently from new Win32::GUI::Font (eg. -height is negative!).
> I'll look into it... for now, a workaround is:
>
> %MyFontData = Win32::GUI::ChooseFont();
> $MyFontData{-height} = -$MyFontData{-height}
> if $MyFontData{-height} < 0;
> $MyFont = new Win32::GUI::Font(%MyFontData);
>
>
> cheers,
> Aldo Calpini
> <[EMAIL PROTECTED]>
>
>
>
>