Login  Register

Re: Unconvinient refresh in image presenter

Posted by Sebastián Sastre on Jul 05, 2006; 1:21pm
URL: https://forum.world.st/Unconvinient-refresh-in-image-presenter-tp3379298p3379371.html

As you said, it does not work for me in D6. It seems to behave
correctly when reducing size but not for increasing it.

I opted for a less elegant solution putting this loose method:


GdiplusImageView>>onPositionChanged: aPositionEvent
        "Private - Handle a window position change event (move or
resize)."

        aPositionEvent isResize ifTrue:[self hide; show].

        ^super onPositionChanged: aPositionEvent


cheers,

Sebastian

Chris Uppal escreveu:

> Sebastián,
>
> >   It happens to me, using #viewMode: #scaleToFit, that when I maximize
> > and then restore the window, when the image is wider than taller, the
> > parts without image (those boxes on the window that are not a
> > proportional part of the box of the resized image) are maintaining the
> > parts of the previous maximized image.
>
> That seems to be a bug somewhere in D6.
>
> In D5, you can avoid that behaviour by setting the view's #isEraseBackground to
> true, /and/ the #backcolor to something non-nil   So the following works OK in
> D5.
>
>     f := 'C:\someFile.jpg'.
>     i := GdiplusImage fromFile: f.
>     p := ImagePresenter show: 'Gdiplus view' on: i.
>     (p view)
>         backcolor: (Color yellow fadedBy: 4);
>         isEraseBackground: true;
>         viewMode: #scaleBestFit;
>         invalidate.
>
> The view erases itself as you change the size or maximise it.
>
> But that doesn't work under D6.  I don't know why, but one hint is that the
> view doesn't seem to have passed its background color to the underlying
> control.
>
>     -- chris