- Draw Image on tab pages if an image list is used.
authorJackson Harper <jackson@novell.com>
Tue, 5 Sep 2006 17:27:45 +0000 (17:27 -0000)
committerJackson Harper <jackson@novell.com>
Tue, 5 Sep 2006 17:27:45 +0000 (17:27 -0000)
svn path=/trunk/mcs/; revision=64953

mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TabControl.cs

index 6fb339c0d72517ab8360a07dc57819aaeae525b8..dbe238709a85cdd7f806cf94ec418b0d077a6e67 100644 (file)
@@ -2,6 +2,7 @@
 
        * TabControl.cs: Better calculation method for setting the slider
        pos. Prevents crashes on really wide tabs.
+       - Draw Image on tab pages if an image list is used.
 
 2006-09-02  Carlos Alberto Cortez <calberto.cortez@gmail.com>
 
index 33017073ce71346e83f73d3c6fbc687fb42eefc2..26a950048dcfeb2253ed3513f60a6be803618837 100644 (file)
@@ -692,6 +692,10 @@ namespace System.Windows.Forms {
                                        width = item_size.Width;
                                } else {
                                        width = (int) DeviceContext.MeasureString (page.Text, Font).Width + (Padding.X * 2);
+                                       if (ImageList != null && page.ImageIndex >= 0 && page.ImageIndex < ImageList.Images.Count) {
+                                               width += ImageList.ImageSize.Width + 2;
+                                               item_size.Height = ImageList.ImageSize.Height + 3;
+                                       }
                                }
 
                                if (i == SelectedIndex)
@@ -810,6 +814,10 @@ namespace System.Windows.Forms {
                                        width = item_size.Width;
                                } else {
                                        width = (int) DeviceContext.MeasureString (page.Text, Font).Width + (Padding.X * 2);
+                                       if (ImageList != null && page.ImageIndex >= 0 && page.ImageIndex < ImageList.Images.Count) {
+                                               width += ImageList.ImageSize.Width + 2;
+                                               item_size.Height = ImageList.ImageSize.Height + 3;
+                                       }
                                }
 
                                if (width < MinimumTabWidth)
@@ -867,6 +875,10 @@ namespace System.Windows.Forms {
                                        width = item_size.Width;
                                } else {                                        
                                        width = (int) DeviceContext.MeasureString (page.Text, Font).Width + (Padding.X * 2);
+                                       if (ImageList != null && page.ImageIndex >= 0 && page.ImageIndex < ImageList.Images.Count) {
+                                               width += ImageList.ImageSize.Width + 2;
+                                               item_size.Height = ImageList.ImageSize.Height + 3;
+                                       }
                                }
 
                                if (width < MinimumTabWidth)