Leberwurstpizza has asked for the wisdom of the Perl Monks concerning the following question:

Hi there ,
is there a way to display bitmaps in a label which is scrollable. I searched the net the whole day but didn't found a solution for this problem.

Also there is no control for this in Win32::GUI.

Any ideas ?

Thanx for your reply ...
Leberwurstpizza ...

  • Comment on Win32::GUI::Label Displaying Bitmaps ( Scrollbars ? )

Replies are listed 'Best First'.
Re: Win32::GUI::Label Displaying Bitmaps ( Scrollbars ? )
by BrowserUk (Patriarch) on May 19, 2003 at 18:34 UTC

    Take a look at Win32::GUI::ImageList. I've not used the control, but it sounds like it would allow you to create a scrollable list of images. Assuming I interpreted your question correctly?


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
      Well,
      it works for my surprise ...
      But that was not the thing i want to ...

      I'm working on a little PicViewer ( like ACDSee or similar )and need a Label which recognizes size of images ( several formats ) and supports it with scrollbars.

      There are 2 ways ( which I know ) in Win32::GUI to display bitmaps => buttons and labels ... both don't support scrollbars ...

      Sure ... another way is to resize images ...
      But it would be interesting for me if there's another way to put up images in a better way ...

      Thanx for your reply ...
      With best regards,
      Leberwurstpizza
Re: Win32::GUI::Label Displaying Bitmaps ( Scrollbars ? )
by jplindstrom (Monsignor) on May 20, 2003 at 20:02 UTC
    You may want to look at the Win32::GUI::Graphic control. It provides the Paint event, which makes it possible for you to paint on the control itself.

    This is from the paintBitmap method of the Win32::GUI::Loft::Control class:

    #Draw rectangle with the image as brush my $brsBitmap = Win32::GUI::Brush->new( -style => 3, #BS_PATTERN -pattern => $bmBitmap, );

    ...

    $dcDev->SelectObject($rhBrush->{noPen}); Win32::GUI::AdHoc::SetBrushOrgEx($dcDev, #Move the brush or +igin $rhPosCache->{left} + $leftBitmap, $rhPosCache->{top} + $topBitmap); $dcDev->SelectObject($brsBitmap); $dcDev->Rectangle( $rhPosCache->{left} + $leftBitmap, $rhPosCache->{top} + $topBitmap, $rhPosCache->{left} + $leftBitmap + $widthBitmap + 1, $rhPosCache->{top} + $topBitmap + $heightBitmap + 1, );

    The example is far from complete, but you get the idea.

    I think you can "scroll" which parts within the image to display by moving it's origin, but I'm not sure.

    If you want, you can download The GUI Loft and look at the source (PPM\Loft\lib\Win32\GUI\Loft\Control.pm and lib\TGL\WindowDesign.pm).

    /J