[Mono-winforms-list] [PATCH] Invalidate non visible areas when scrolling

Carlos Alberto Cortez calberto.cortez at gmail.com
Mon Oct 1 23:47:22 EDT 2007


Hey

Basically we are scrolling a control and right now we are assuming that the
control is completely visible.

For example: Imagine we have a ListView in a form, and that the Form size is
minor than the ListView - specifically the ListView control has a bigger
height than the form:

---------------------
|    -----------     | <- This if the form
|    |          |    |
|_  | ____  | __|
    |          |
    |_____ |  <- This is the ListView (with bigger Height)

Now, from XplatUIX1.ScrollWindow we get a Rectangle to scroll, as well as
XAmount/YAmount variables. So, when we have more items than the visible area
of the ListView can contain, we will need to scroll, and we pass the entire
Rectangle to ScrollWindow, as well as a YAmount value.

Now, ScrollWindow copies some area when scrolling, and invalidates the 'new'
visible area. So if we are scrolling our ListView (to see items below) we
have a call such:

ScrollWindow (handle, lv.ClientRectangle, yamount, 0, false);

It tries to copy the area -lv.ClientRectangle- to a new position below (say,
48 pixels), and the 48 pixels at the top are invalidated in ListView. So, as
it can be seen, our ScrollWindow method does think that the scrolled area is
visible. BUT, as the ListView sample shows, it can happen that the control
is not actually visible (in the sample, the bottom area of the ListView is
NOT visible).

This is why we need to invalidate the areas that we are scrolling *and* were
not previously visible.

I hope this explanation helps.

Carlos.

2007/10/1, Chris Toshok <toshok at ximian.com>:
>
> [d'oh.  sent this already from my hungry.com address, but I think the
> list software will block it since I'm subcribed @ximian.com..]
>
>
> I'm confused.  Why are we invalidating non-visible parts of the screen?
> They're not visible.
>
> Chris
>
> On Mon, 2007-09-24 at 14:27 -0500, Carlos Alberto Cortez wrote:
> > Hey,
> >
> > While trying to fox bug #324513, I notice that trying to scroll a
> > control, which has bigger bounds than any of its Parents controls,
> > shows some drawing issues.
> >
> > Example: you have a VScrollBar with Height > than its contaning form:
> >
> >   __________
> >   |        |          | <- This is the form (Parent)
> >   |____|_____|
> >            | <- This is the scrollbar
> >
> > This is because when we try to scroll a windows, we copy some area of
> > it and invalidate the 'new visible' one.
> > But we assume that the entire control is visible (that all its Bounds
> > are painted and available to scroll). But it's not the case in this
> > case, where the VScrollBar is not entirely visible,
> > because it's parents Bounds don't contain it.
> >
> > The attached patch tries to detect all the non-visible regions of a
> > control (top, bottom, right, left) and then check if whe are trying to
> > scroll part of the non visible area,
> > which then is invalidated.
> >
> > Carlos.
> > _______________________________________________
> > Mono-winforms-list maillist  -  Mono-winforms-list at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/mono-winforms-list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-winforms-list/attachments/20071001/35368ea2/attachment-0001.html 


More information about the Mono-winforms-list mailing list