[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms ControlPaint.cs
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms ControlPaint.cs,1.5,1.6 |
Date: |
Mon, 23 Jun 2003 02:49:05 -0400 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms
In directory subversions:/tmp/cvs-serv27967/System.Windows.Forms
Modified Files:
ControlPaint.cs
Log Message:
Implement some more of the "ControlPaint" utility class.
Index: ControlPaint.cs
===================================================================
RCS file: /cvsroot/dotgnu-pnet/pnetlib/System.Windows.Forms/ControlPaint.cs,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** ControlPaint.cs 21 Jun 2003 21:51:40 -0000 1.5
--- ControlPaint.cs 23 Jun 2003 06:49:03 -0000 1.6
***************
*** 307,311 ****
}
}
- [TODO]
public static void DrawBorder
(Graphics graphics, Rectangle bounds, Color
leftColor,
--- 307,310 ----
***************
*** 316,320 ****
ButtonBorderStyle bottomStyle)
{
! // TODO
}
--- 315,735 ----
ButtonBorderStyle bottomStyle)
{
! Pen pen;
! float percent, change;
!
! // Paint the left side of the border.
! if(leftWidth > 0)
! {
! switch(leftStyle)
! {
! case ButtonBorderStyle.Dotted:
! {
! pen = new
Pen(leftColor, 1.0f);
! pen.EndCap =
LineCap.Square;
! pen.DashStyle =
DashStyle.Dot;
! while(leftWidth > 0)
! {
! --leftWidth;
!
graphics.DrawLine
! (pen,
bounds.X + leftWidth,
!
bounds.Y + leftWidth + 1,
!
bounds.X + leftWidth,
!
bounds.Y + bounds.Height - leftWidth - 2);
! }
! pen.Dispose();
! }
! break;
!
! case ButtonBorderStyle.Dashed:
! {
! pen = new
Pen(leftColor, 1.0f);
! pen.EndCap =
LineCap.Square;
! pen.DashStyle =
DashStyle.Dash;
! while(leftWidth > 0)
! {
! --leftWidth;
!
graphics.DrawLine
! (pen,
bounds.X + leftWidth,
!
bounds.Y + leftWidth + 1,
!
bounds.X + leftWidth,
!
bounds.Y + bounds.Height - leftWidth - 2);
! }
! pen.Dispose();
! }
! break;
!
! case ButtonBorderStyle.Solid:
! {
! pen = new
Pen(leftColor, 1.0f);
! pen.EndCap =
LineCap.Square;
! while(leftWidth > 0)
! {
! --leftWidth;
!
graphics.DrawLine
! (pen,
bounds.X + leftWidth,
!
bounds.Y + leftWidth + 1,
!
bounds.X + leftWidth,
!
bounds.Y + bounds.Height - leftWidth - 2);
! }
! pen.Dispose();
! }
! break;
!
! case ButtonBorderStyle.Inset:
! {
! change = (1.0f /
leftWidth);
! percent = 1.0f;
! while(leftWidth > 0)
! {
! --leftWidth;
! pen = new
Pen(Dark(leftColor, percent), 1.0f);
! pen.EndCap =
LineCap.Square;
!
graphics.DrawLine
! (pen,
bounds.X + leftWidth,
!
bounds.Y + leftWidth + 1,
!
bounds.X + leftWidth,
!
bounds.Y + bounds.Height - leftWidth - 2);
! pen.Dispose();
! percent -=
change;
! }
! }
! break;
!
! case ButtonBorderStyle.Outset:
! {
! change = (1.0f /
leftWidth);
! percent = change;
! while(leftWidth > 0)
! {
! --leftWidth;
! pen = new
Pen(Light(leftColor, percent), 1.0f);
! pen.EndCap =
LineCap.Square;
!
graphics.DrawLine
! (pen,
bounds.X + leftWidth,
!
bounds.Y + leftWidth + 1,
!
bounds.X + leftWidth,
!
bounds.Y + bounds.Height - leftWidth - 2);
! pen.Dispose();
! percent +=
change;
! }
! }
! break;
! }
! }
!
! // Paint the top side of the border.
! if(topWidth > 0)
! {
! switch(topStyle)
! {
! case ButtonBorderStyle.Dotted:
! {
! pen = new Pen(topColor,
1.0f);
! pen.EndCap =
LineCap.Square;
! pen.DashStyle =
DashStyle.Dot;
! while(topWidth > 0)
! {
! --topWidth;
!
graphics.DrawLine
! (pen,
bounds.X + topWidth,
!
bounds.Y + topWidth,
!
bounds.X + bounds.Width - 1 - topWidth,
!
bounds.Y + topWidth);
! }
! pen.Dispose();
! }
! break;
!
! case ButtonBorderStyle.Dashed:
! {
! pen = new Pen(topColor,
1.0f);
! pen.EndCap =
LineCap.Square;
! pen.DashStyle =
DashStyle.Dash;
! while(topWidth > 0)
! {
! --topWidth;
!
graphics.DrawLine
! (pen,
bounds.X + topWidth,
!
bounds.Y + topWidth,
!
bounds.X + bounds.Width - 1 - topWidth,
!
bounds.Y + topWidth);
! }
! pen.Dispose();
! }
! break;
!
! case ButtonBorderStyle.Solid:
! {
! pen = new Pen(topColor,
1.0f);
! pen.EndCap =
LineCap.Square;
! while(topWidth > 0)
! {
! --topWidth;
!
graphics.DrawLine
! (pen,
bounds.X + topWidth,
!
bounds.Y + topWidth,
!
bounds.X + bounds.Width - 1 - topWidth,
!
bounds.Y + topWidth);
! }
! pen.Dispose();
! }
! break;
!
! case ButtonBorderStyle.Inset:
! {
! change = (1.0f /
topWidth);
! percent = 1.0f;
! while(topWidth > 0)
! {
! --topWidth;
! pen = new
Pen(Dark(leftColor, percent), 1.0f);
! pen.EndCap =
LineCap.Square;
!
graphics.DrawLine
! (pen,
bounds.X + topWidth,
!
bounds.Y + topWidth,
!
bounds.X + bounds.Width - 1 - topWidth,
!
bounds.Y + topWidth);
! pen.Dispose();
! percent -=
change;
! }
! }
! break;
!
! case ButtonBorderStyle.Outset:
! {
! change = (1.0f /
topWidth);
! percent = change;
! while(topWidth > 0)
! {
! --topWidth;
! pen = new
Pen(Light(leftColor, percent), 1.0f);
! pen.EndCap =
LineCap.Square;
!
graphics.DrawLine
! (pen,
bounds.X + topWidth,
!
bounds.Y + topWidth,
!
bounds.X + bounds.Width - 1 - topWidth,
!
bounds.Y + topWidth);
! pen.Dispose();
! percent +=
change;
! }
! }
! break;
! }
! }
!
! // Paint the right side of the border.
! if(rightWidth > 0)
! {
! switch(rightStyle)
! {
! case ButtonBorderStyle.Dotted:
! {
! pen = new
Pen(rightColor, 1.0f);
! pen.EndCap =
LineCap.Square;
! pen.DashStyle =
DashStyle.Dot;
! while(rightWidth > 0)
! {
! --rightWidth;
!
graphics.DrawLine
! (pen,
!
bounds.X + bounds.Width - 1 - rightWidth,
!
bounds.Y + rightWidth,
!
bounds.X + bounds.Width - 1 - rightWidth,
!
bounds.Y + bounds.Height - 1 - rightWidth);
! }
! pen.Dispose();
! }
! break;
!
! case ButtonBorderStyle.Dashed:
! {
! pen = new
Pen(rightColor, 1.0f);
! pen.EndCap =
LineCap.Square;
! pen.DashStyle =
DashStyle.Dash;
! while(rightWidth > 0)
! {
! --rightWidth;
!
graphics.DrawLine
! (pen,
!
bounds.X + bounds.Width - 1 - rightWidth,
!
bounds.Y + rightWidth,
!
bounds.X + bounds.Width - 1 - rightWidth,
!
bounds.Y + bounds.Height - 1 - rightWidth);
! }
! pen.Dispose();
! }
! break;
!
! case ButtonBorderStyle.Solid:
! {
! pen = new
Pen(rightColor, 1.0f);
! pen.EndCap =
LineCap.Square;
! while(rightWidth > 0)
! {
! --rightWidth;
!
graphics.DrawLine
! (pen,
!
bounds.X + bounds.Width - 1 - rightWidth,
!
bounds.Y + rightWidth,
!
bounds.X + bounds.Width - 1 - rightWidth,
!
bounds.Y + bounds.Height - 1 - rightWidth);
! }
! pen.Dispose();
! }
! break;
!
! case ButtonBorderStyle.Inset:
! {
! change = (1.0f /
rightWidth);
! percent = 1.0f;
! while(rightWidth > 0)
! {
! --rightWidth;
! pen = new
Pen(Dark(leftColor, percent), 1.0f);
! pen.EndCap =
LineCap.Square;
!
graphics.DrawLine
! (pen,
!
bounds.X + bounds.Width - 1 - rightWidth,
!
bounds.Y + rightWidth,
!
bounds.X + bounds.Width - 1 - rightWidth,
!
bounds.Y + bounds.Height - 1 - rightWidth);
! pen.Dispose();
! percent -=
change;
! }
! }
! break;
!
! case ButtonBorderStyle.Outset:
! {
! change = (1.0f /
rightWidth);
! percent = change;
! while(rightWidth > 0)
! {
! --rightWidth;
! pen = new
Pen(Light(leftColor, percent), 1.0f);
! pen.EndCap =
LineCap.Square;
!
graphics.DrawLine
! (pen,
!
bounds.X + bounds.Width - 1 - rightWidth,
!
bounds.Y + rightWidth,
!
bounds.X + bounds.Width - 1 - rightWidth,
!
bounds.Y + bounds.Height - 1 - rightWidth);
! pen.Dispose();
! percent +=
change;
! }
! }
! break;
! }
! }
!
! // Paint the bottom side of the border.
! if(bottomWidth > 0)
! {
! switch(bottomStyle)
! {
! case ButtonBorderStyle.Dotted:
! {
! pen = new
Pen(bottomColor, 1.0f);
! pen.EndCap =
LineCap.Square;
! pen.DashStyle =
DashStyle.Dot;
! while(bottomWidth > 0)
! {
! --bottomWidth;
!
graphics.DrawLine
! (pen,
!
bounds.X + bottomWidth,
!
bounds.Y + bounds.Height - 1 - bottomWidth,
!
bounds.X + bounds.Width - 2 - bottomWidth,
!
bounds.Y +
!
bounds.Height - 1 - bottomWidth);
! }
! pen.Dispose();
! }
! break;
!
! case ButtonBorderStyle.Dashed:
! {
! pen = new
Pen(bottomColor, 1.0f);
! pen.EndCap =
LineCap.Square;
! pen.DashStyle =
DashStyle.Dash;
! while(bottomWidth > 0)
! {
! --bottomWidth;
!
graphics.DrawLine
! (pen,
!
bounds.X + bottomWidth,
!
bounds.Y + bounds.Height - 1 - bottomWidth,
!
bounds.X + bounds.Width - 2 - bottomWidth,
!
bounds.Y +
!
bounds.Height - 1 - bottomWidth);
! }
! pen.Dispose();
! }
! break;
!
! case ButtonBorderStyle.Solid:
! {
! pen = new
Pen(bottomColor, 1.0f);
! pen.EndCap =
LineCap.Square;
! while(bottomWidth > 0)
! {
! --bottomWidth;
!
graphics.DrawLine
! (pen,
!
bounds.X + bottomWidth,
!
bounds.Y + bounds.Height - 1 - bottomWidth,
!
bounds.X + bounds.Width - 2 - bottomWidth,
!
bounds.Y +
!
bounds.Height - 1 - bottomWidth);
! }
! pen.Dispose();
! }
! break;
!
! case ButtonBorderStyle.Inset:
! {
! change = (1.0f /
bottomWidth);
! percent = 1.0f;
! while(bottomWidth > 0)
! {
! --bottomWidth;
! pen = new
Pen(Dark(leftColor, percent), 1.0f);
! pen.EndCap =
LineCap.Square;
!
graphics.DrawLine
! (pen,
!
bounds.X + bottomWidth,
!
bounds.Y + bounds.Height - 1 - bottomWidth,
!
bounds.X + bounds.Width - 2 - bottomWidth,
!
bounds.Y +
!
bounds.Height - 1 - bottomWidth);
! pen.Dispose();
! percent -=
change;
! }
! }
! break;
!
! case ButtonBorderStyle.Outset:
! {
! change = (1.0f /
bottomWidth);
! percent = change;
! while(bottomWidth > 0)
! {
! --bottomWidth;
! pen = new
Pen(Light(leftColor, percent), 1.0f);
! pen.EndCap =
LineCap.Square;
!
graphics.DrawLine
! (pen,
!
bounds.X + bottomWidth,
!
bounds.Y + bounds.Height - 1 - bottomWidth,
!
bounds.X + bounds.Width - 2 - bottomWidth,
!
bounds.Y +
!
bounds.Height - 1 - bottomWidth);
! pen.Dispose();
! percent +=
change;
! }
! }
! break;
! }
! }
}
***************
*** 646,654 ****
// Draw a container grab handle.
- [TODO]
public static void DrawContainerGrabHandle
(Graphics graphics, Rectangle rectangle)
{
! // TODO
}
--- 1061,1108 ----
// Draw a container grab handle.
public static void DrawContainerGrabHandle
(Graphics graphics, Rectangle rectangle)
{
! Pen black = new Pen(Color.Black, 1.0f);
! black.EndCap = LineCap.Square;
! graphics.FillRectangle(Brushes.White,
rectangle);
! graphics.DrawRectangle(black, rectangle);
! graphics.DrawLine
! (black,
! rectangle.X + rectangle.Width / 2,
! rectangle.Y + 2,
! rectangle.X + rectangle.Width / 2,
! rectangle.Y + rectangle.Height - 3);
! graphics.DrawLine
! (black,
! rectangle.X + 2,
! rectangle.Y + rectangle.Height / 2,
! rectangle.X + rectangle.Width - 3,
! rectangle.Y + rectangle.Height / 2);
! graphics.DrawLine
! (black,
! rectangle.X + rectangle.Width / 2 - 1,
! rectangle.Y + 3,
! rectangle.X + rectangle.Width / 2 + 1,
! rectangle.Y + 3);
! graphics.DrawLine
! (black,
! rectangle.X + rectangle.Width / 2 - 1,
! rectangle.Y + rectangle.Height - 4,
! rectangle.X + rectangle.Width / 2 + 1,
! rectangle.Y + rectangle.Height - 4);
! graphics.DrawLine
! (black,
! rectangle.X + 3,
! rectangle.Y + rectangle.Height / 2 - 1,
! rectangle.X + 3,
! rectangle.Y + rectangle.Height / 2 +
1);
! graphics.DrawLine
! (black,
! rectangle.X + rectangle.Width - 4,
! rectangle.Y + rectangle.Height / 2 - 1,
! rectangle.X + rectangle.Width - 4,
! rectangle.Y + rectangle.Height / 2 +
1);
! black.Dispose();
}
***************
*** 673,682 ****
// Draw a grab handle.
- [TODO]
public static void DrawGrabHandle
(Graphics graphics, Rectangle rectangle,
bool primary, bool enabled)
{
! // TODO
}
--- 1127,1164 ----
// Draw a grab handle.
public static void DrawGrabHandle
(Graphics graphics, Rectangle rectangle,
bool primary, bool enabled)
{
! Brush background;
! Pen border;
! if(primary)
! {
! if(enabled)
! {
! background = Brushes.White;
! border = Pens.Black;
! }
! else
! {
! background =
SystemBrushes.Control;
! border = Pens.Black;
! }
! }
! else
! {
! if(enabled)
! {
! background = Brushes.Black;
! border = Pens.White;
! }
! else
! {
! background =
SystemBrushes.Control;
! border = Pens.White;
! }
! }
! graphics.FillRectangle(background, rectangle);
! graphics.DrawRectangle(border, rectangle);
}
***************
*** 699,707 ****
// Draw a locked selection frame.
- [TODO]
public static void DrawLockedFrame
(Graphics graphics, Rectangle rectangle, bool
primary)
{
! // TODO
}
--- 1181,1206 ----
// Draw a locked selection frame.
public static void DrawLockedFrame
(Graphics graphics, Rectangle rectangle, bool
primary)
{
! Pen outer;
! Pen inner;
! if(primary)
! {
! outer = Pens.White;
! inner = Pens.Black;
! }
! else
! {
! outer = Pens.Black;
! inner = Pens.White;
! }
! graphics.DrawRectangle(outer, rectangle);
! graphics.DrawRectangle
! (outer, rectangle.X + 1, rectangle.Y +
1,
! rectangle.Width - 2, rectangle.Height
- 2);
! graphics.DrawRectangle
! (inner, rectangle.X + 2, rectangle.Y +
2,
! rectangle.Width - 4, rectangle.Height
- 4);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms ControlPaint.cs,1.5,1.6,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms Control.cs,1.18,1.19 Form.cs,1.12,1.13
- Next by Date:
[Dotgnu-pnet-commits] CVS: pnetlib ChangeLog,1.1081,1.1082
- Previous by thread:
[Dotgnu-pnet-commits] CVS: pnetlib/System.Windows.Forms Control.cs,1.18,1.19 Form.cs,1.12,1.13
- Next by thread:
[Dotgnu-pnet-commits] CVS: pnetlib ChangeLog,1.1081,1.1082
- Index(es):