dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnetlib ChangeLog System.Windows.Forms/ListBox.cs


From: Radek Polak
Subject: [dotgnu-pnet-commits] pnetlib ChangeLog System.Windows.Forms/ListBox.cs
Date: Sun, 08 Mar 2009 14:50:07 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    pnetlib
Changes by:     Radek Polak <radekp>    09/03/08 14:50:07

Modified files:
        .              : ChangeLog 
        System.Windows.Forms: ListBox.cs 

Log message:
        implement DrawMode for listbox

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnetlib/ChangeLog?cvsroot=dotgnu-pnet&r1=1.2569&r2=1.2570
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System.Windows.Forms/ListBox.cs?cvsroot=dotgnu-pnet&r1=1.21&r2=1.22

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/ChangeLog,v
retrieving revision 1.2569
retrieving revision 1.2570
diff -u -b -r1.2569 -r1.2570
--- ChangeLog   7 Mar 2009 07:12:07 -0000       1.2569
+++ ChangeLog   8 Mar 2009 14:50:03 -0000       1.2570
@@ -1,3 +1,7 @@
+2009-03-08  Radek Polak  <address@hidden>
+
+       * System.Windows.Forms/ListBox.cs: Implement DrawMode property.
+
 2009-03-01  Radek Polak  <address@hidden>
 
        * System/Collections/Specialized/ListDictionary.cs: Fix setter for list

Index: System.Windows.Forms/ListBox.cs
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/System.Windows.Forms/ListBox.cs,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- System.Windows.Forms/ListBox.cs     25 Feb 2009 13:52:06 -0000      1.21
+++ System.Windows.Forms/ListBox.cs     8 Mar 2009 14:50:05 -0000       1.22
@@ -62,6 +62,7 @@
        private bool integralHeight = true;
        private int columnWidth = 100;
        private int itemHeight = 15;
+       private DrawMode drawMode = DrawMode.Normal;
 
 
        // Helpers, to replace the missing "Math" class in some profiles.
@@ -760,15 +761,19 @@
                }
        }
 
-       [TODO]
        public virtual DrawMode DrawMode
        {
                get
                {
-                       return DrawMode.Normal;
+                       return drawMode;
                }
                set
                {
+                       if(value != drawMode)
+                       {
+                               this.drawMode = value;
+                               Invalidate();
+                       }
                }
        }
 
@@ -1729,7 +1734,24 @@
        protected internal virtual void PaintItem(Graphics g, int index, string 
text, Font font, Brush textBrush,
                Rectangle itemRect, StringFormat format)
        {
+               if(drawMode == DrawMode.Normal)
+               {
                g.DrawString(text, this.Font, textBrush, itemRect, format);
+                       return;
+               }
+
+               DrawItemState state = DrawItemState.None;
+               foreach(int selected in selectedIndices)
+               {
+                       if(selected == index)
+                       {
+                               state |= DrawItemState.Selected;
+                               break;
+                       }
+               }
+
+               OnDrawItem(new DrawItemEventArgs(g, font, itemRect, index, 
state,
+                                                                               
 ForeColor, BackColor));
        }
 
        private void PaintItem(Graphics g, int dataIndex)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]