[Mono-dev] ListBox.cs ownder draw variable size

Carlos Alberto Cortez calberto.cortez at gmail.com
Fri May 30 18:54:01 EDT 2008


Hey, 

Two things for your next patch:

* Use the coding guidelines:
http://www.mono-project.com/Coding_Guidelines
* Send your patch as an attached file, not in the body of the message.

Committed your patch,
thanks for the correction!

Carlos.


El mié, 28-05-2008 a las 06:42 +0200, jkeymer escribió:
> Handles calculation if the listbox scroll area of variable high, owner
> draw boxes,
> 
> Index: Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
> ===================================================================
> --- Managed.Windows.Forms/System.Windows.Forms/ListBox.cs    (Revision
> 103872)
> +++ Managed.Windows.Forms/System.Windows.Forms/ListBox.cs    (Arbeitskopie)
> @@ -2145,9 +2145,20 @@
>              last_visible_index = LastVisibleItem ();
> 
>              int diff = top_item - top_index;
> -
> +            int delta = ItemHeight * diff;
> +            if (DrawMode == DrawMode.OwnerDrawVariable) {
> +                delta = 0;
> +                if ( top_index < top_item ) {
> +                    for ( int i = top_index; i < top_item; i++ )
> +                        delta += GetItemHeight(i);
> +                }
> +                else {
> +                    for ( int i = top_item; i < top_index; i++ )
> +                        delta -= GetItemHeight(i);
> +                }
> +            }
>              if (IsHandleCreated)
> -                XplatUI.ScrollWindow (Handle, items_area, 0, ItemHeight
> * diff, false);
> +                XplatUI.ScrollWindow (Handle, items_area, 0, delta, false);
>          }
> 
>          #endregion Private Methods
> 
> 
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list



More information about the Mono-devel-list mailing list