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/StatusBa...


From: Radek Polak
Subject: [dotgnu-pnet-commits] pnetlib ChangeLog System.Windows.Forms/StatusBa...
Date: Fri, 27 Feb 2009 13:55:07 +0000

CVSROOT:        /sources/dotgnu-pnet
Module name:    pnetlib
Changes by:     Radek Polak <radekp>    09/02/27 13:55:07

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

Log message:
        draw icon in status bar

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/pnetlib/ChangeLog?cvsroot=dotgnu-pnet&r1=1.2564&r2=1.2565
http://cvs.savannah.gnu.org/viewcvs/pnetlib/System.Windows.Forms/StatusBar.cs?cvsroot=dotgnu-pnet&r1=1.12&r2=1.13

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/ChangeLog,v
retrieving revision 1.2564
retrieving revision 1.2565
diff -u -b -r1.2564 -r1.2565
--- ChangeLog   27 Feb 2009 13:52:19 -0000      1.2564
+++ ChangeLog   27 Feb 2009 13:55:06 -0000      1.2565
@@ -1,5 +1,9 @@
 2009-02-27  Radek Polak  <address@hidden>
 
+       * System.Windows.Forms/StatusBar.cs: Draw icon in panel.
+
+2009-02-27  Radek Polak  <address@hidden>
+
        * DotGNU.SSL/GNUTLS.cs: Remove IDisposable interface from gnutls_datum.
        For structs it makes no sence because calls to any interface method will
        box and thus copy members including pointer to data. Later use of this

Index: System.Windows.Forms/StatusBar.cs
===================================================================
RCS file: /sources/dotgnu-pnet/pnetlib/System.Windows.Forms/StatusBar.cs,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- System.Windows.Forms/StatusBar.cs   25 Feb 2009 10:36:10 -0000      1.12
+++ System.Windows.Forms/StatusBar.cs   27 Feb 2009 13:55:07 -0000      1.13
@@ -66,6 +66,7 @@
 
                protected override void OnPaint(PaintEventArgs e)
                {
+                       Graphics g = e.Graphics;
                        if (showPanels == false)
                        {
                                DrawSimpleText(e, 0, 0, Width, Height, Text);
@@ -85,13 +86,17 @@
                                        {
                                                panelWidth = Width;
                                        }
-                                       ControlPaint.DrawBorder3D(e.Graphics, 
0, 2, panelWidth, Height - 2, Border3DStyle.SunkenOuter, Border3DSide.All);
+                                       ControlPaint.DrawBorder3D(g, 0, 2, 
panelWidth, Height - 2, Border3DStyle.SunkenOuter, Border3DSide.All);
                                }
                                else
                                {
                                        for (int i=0;i<panels.Count;i++)
                                        {
-                                               switch (panels[i].BorderStyle)
+                                               StatusBarPanel panel = 
panels[i];
+                                               Icon icon = panel.Icon;
+                                               int textLeft = left;
+
+                                               switch (panel.BorderStyle)
                                                {
                                                        case 
StatusBarPanelBorderStyle.None:
                                                                style = 
Border3DStyle.Flat;
@@ -103,11 +108,16 @@
                                                                style = 
Border3DStyle.SunkenOuter;
                                                                break;
                                                }
-                                               
ControlPaint.DrawBorder3D(e.Graphics, left, 4, panels[i].Width, Height -4, 
style, Border3DSide.All);
-                                               if (panels[i].Style == 
StatusBarPanelStyle.Text)
+                                               ControlPaint.DrawBorder3D(g, 
left, 4, panel.Width, Height -4, style, Border3DSide.All);
+                                               if (icon != null)
+                                               {
+                                                       g.DrawIcon(icon, left, 
(Height - icon.Height) / 2);
+                                                       textLeft += icon.Width;
+                                               }
+                                               if (panel.Style == 
StatusBarPanelStyle.Text)
                                                {
                                                        StringAlignment align = 
0;
-                                                       switch 
(panels[i].Alignment)
+                                                       switch (panel.Alignment)
                                                        {
                                                                case 
HorizontalAlignment.Center:
                                                                        align = 
StringAlignment.Center;
@@ -119,22 +129,22 @@
                                                                        align = 
StringAlignment.Far;
                                                                        break;
                                                        }                       
                                
-                                                       DrawSimpleText(e, left, 
4, left + panels[i].Width, Height,  panels[i].Text, align);
+                                                       DrawSimpleText(e, 
textLeft, 4, left + panel.Width, Height, panel.Text, align);
                                                }
                                                else
                                                {
                                                        // Owner drawn
-                                                       
StatusBarDrawItemEventArgs args = new StatusBarDrawItemEventArgs(e.Graphics, 
this.Font, new Rectangle(0, 0, panels[i].Width, Height), i, DrawItemState.None, 
panels[i]);
+                                                       
StatusBarDrawItemEventArgs args = new StatusBarDrawItemEventArgs(g, this.Font, 
new Rectangle(0, 0, panel.Width, Height), i, DrawItemState.None, panel);
                                                        OnDrawItem(args);
                                                }
-                                               left += panels[i].Width +2;
+                                               left += panel.Width +2;
                                        }
                                }
                        }
 
                        if (sizingGrip == true)
                        {
-                               ControlPaint.DrawSizeGrip(e.Graphics, 
BackColor, new Rectangle(Width - 16, Height - 16, Width, Height));
+                               ControlPaint.DrawSizeGrip(g, BackColor, new 
Rectangle(Width - 16, Height - 16, Width, Height));
                        }
                        base.OnPaint(e);
                }




reply via email to

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