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

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

[Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms ControlPaint.cs


From: Gopal.V <address@hidden>
Subject: [Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms ControlPaint.cs,1.2,1.3 ProgressBar.cs,1.1,1.2
Date: Fri, 20 Jun 2003 18:12:11 -0400

Update of /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms
In directory subversions:/tmp/cvs-serv10326/System.Windows.Forms

Modified Files:
        ControlPaint.cs ProgressBar.cs 
Log Message:
Split out all ProgressBar drawing into ControlPaint


Index: ControlPaint.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/ControlPaint.cs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** ControlPaint.cs     13 Jun 2003 20:58:27 -0000      1.2
--- ControlPaint.cs     20 Jun 2003 22:12:09 -0000      1.3
***************
*** 441,445 ****
                        }
  
!       public static void DrawBlock(Graphics graphics, int x, int y,
                                                                        int 
width, int height,
                                                                        Color 
color)
--- 441,480 ----
                        }
  
!       internal static void DrawProgressBar(Graphics graphics, int x, int y,
!                                                                               
int width, int height, 
!                                                                               
int steps, int step,
!                                                                               
int value, bool enabled)
!                       {
!                               // TODO : draw disabled mode progressbar
!                               // TODO : handle large no of blocks ie merge 
cases
!                               int blockWidth, blockHeight, xSpacing, ySpacing;
!                               DrawBorder3D(graphics,x,y,width,height);
!                               width-=4;
!                               height-=4;
!                               x+=2;
!                               y+=2;
! 
!                               xSpacing=2;
!                               ySpacing=2;
!                               width=width-((steps-1)*xSpacing);
!                               blockWidth=width/steps;
!                               blockHeight=height-ySpacing-1;
!                                               
!                               x+=2*xSpacing;
! 
!                               for(int i=0;i<steps;i++)
!                               {
!                                       if((i*step) < value)
!                                       {
!                                               
ControlPaint.DrawBlock(graphics, x, y+ySpacing, 
!                                                                               
        blockWidth,
!                                                                               
        blockHeight,
!                                                                               
        SystemColors.Highlight);
!                                       }
!                                       x+=blockWidth+xSpacing;
!                               }
!                       }
! 
!       internal static void DrawBlock(Graphics graphics, int x, int y,
                                                                        int 
width, int height,
                                                                        Color 
color)
***************
*** 448,458 ****
                                Pen pen;
                                brush=new SolidBrush(color);
-                               /*pen=new Pen(Light(color),1.0f);               
                
-                               graphics.DrawRectangle(pen, x, y, width, 
height);
-                               pen.Dispose();
-                               x+=1;
-                               y+=1;
-                               width-=2;
-                               height-=2;*/
                                graphics.FillRectangle(brush, x, y, width, 
height);
                                brush.Dispose();
--- 483,486 ----

Index: ProgressBar.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/ProgressBar.cs,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** ProgressBar.cs      13 Jun 2003 20:58:27 -0000      1.1
--- ProgressBar.cs      20 Jun 2003 22:12:09 -0000      1.2
***************
*** 32,36 ****
                private int min=0,max=100,value=0;
                private int step=10;
!               private int range=max-min;
  
                public ProgressBar() : base("ProgressBar")
--- 32,36 ----
                private int min=0,max=100,value=0;
                private int step=10;
!               private int range=100;
  
                public ProgressBar() : base("ProgressBar")
***************
*** 48,55 ****
                                int x = 0;
                                int y = 0;
!                               int width = clientSize.Width;
!                               int height = clientSize.Height;
                                int steps=range/step;
-                               int blockWidth, blockHeight, xSpacing, ySpacing;
                                
                                using(Brush brush=CreateBackgroundBrush())
--- 48,54 ----
                                int x = 0;
                                int y = 0;
!                               int width=clientSize.Width;
!                               int height=clientSize.Height;
                                int steps=range/step;
                                
                                using(Brush brush=CreateBackgroundBrush())
***************
*** 57,88 ****
                                        
graphics.FillRectangle(brush,x,y,width,height);
                                }
! 
!                               ControlPaint.DrawBorder3D(graphics, 
!                                                                               
          x,y,width,height);
! 
!                               width-=4;
!                               height-=4;
!                               x+=2;
!                               y+=2;
! 
!                               xSpacing=2;
!                               ySpacing=2;
!                               width=width-((steps-1)*xSpacing);
!                               blockWidth=width/steps;
!                               blockHeight=height-ySpacing-1;
!                                               
!                               x+=2*xSpacing;
! 
!                               for(int i=0;i<steps;i++)
!                               {
!                                       if((i*step) < value)
!                                       {
!                                               
ControlPaint.DrawBlock(graphics, x, y+ySpacing, 
!                                                                               
        blockWidth,
!                                                                               
        blockHeight,
!                                                                               
        SystemColors.Highlight);
!                                       }
!                                       x+=blockWidth+xSpacing;
!                               }
                        }
  
--- 56,64 ----
                                        
graphics.FillRectangle(brush,x,y,width,height);
                                }
!                               ControlPaint.DrawProgressBar(graphics, x, y, 
!                                                                               
        clientSize.Width,
!                                                                               
        clientSize.Height, 
!                                                                               
        steps, step,
!                                                                               
        value, this.Enabled);
                        }
  
***************
*** 103,107 ****
                protected override void OnPaint(PaintEventArgs args)
                        {
!                               Redraw();
                                base.OnPaint(args);
                        }
--- 79,83 ----
                protected override void OnPaint(PaintEventArgs args)
                        {
!                               Draw(args.Graphics);
                                base.OnPaint(args);
                        }
***************
*** 115,126 ****
                public void PerformStep()
                        {
!                               if(value>=max)
!                               {
!                                       value=min;
!                               }
!                               else
!                               {
!                                       value=(value + (step - (value % step)));
!                               }
                                Redraw();
                        }
--- 91,95 ----
                public void PerformStep()
                        {
!                               value=(value + (step - (value % step)));
                                Redraw();
                        }





reply via email to

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