Helen, good question...

No idea off hand. Seems I read about sizers that the control "communicates" a minimum size to the sizer process. Maybe there is a clue there. Most of the documentation refers to stretching controls not compressing them. Your "kludge" may be the way to go, at least until another idea surfaces.

Once again from the wxBook(well worth $38 to Amazon):

"(Sizers)...It is based upon the idea of individual windows reporting their minimal required size and their ability to be stretched if the size of the parent window has changed. This will most often mean that the programmer does not set the initial size of the dialog; instead, the dialog will be assigned a sizer, which will be queried about the recommended size....The minimal size of a control is calculated from the control's notion of it's "best size"(supplied by implementing DoGetBestSize for each control)....However, if you want the initial window size(as passed to the window's constructor) to be used as the initial minimum size instead, you can use the wxFIXED_MINSIZE style when adding the control to the sizer. Note that only some windows can calculate their size....whereas others....don't have any natural width or height and thus require an explicit size."

Update1: The Wx::Image::Rescale seems to work. Try a subset of this in your resize event handler. Two scaling qualities are supported: wxIMAGE_QUALITY_NORMAL and wxIMAGE_QUALITY_HIGH(better quality but slower).

Wx::InitAllImageHandlers; $img = Wx::Image->new($parms{image_fname}, wxBITMAP_TYPE_ANY); my $h = $img->GetHeight; my $w = $img->GetWidth; $img->Rescale($w-150, $h-50); my $bmp = Wx::Bitmap->new($img); $sb = Wx::StaticBitmap->new($panel, -1, $bmp);

Update2: Fixed a typo.

Update3: Seems you may want to scale from the original Wx::Image each time to avoid compounding any scaling artifacts/losses of resolution.

James

There's never enough time to do it right, but always enough time to do it over...


In reply to Re^3: wxPerl: is BitmapFromImage implemented? by jmlynesjr
in thread wxPerl: is BitmapFromImage implemented? by HelenCr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.