Author: jackson
Date: 2007-03-06 14:27:47 -0500 (Tue, 06 Mar 2007)
New Revision: 73835
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs
Log:
- Implement 2.0 LineColors property. Lets you change the color
of
the lines in the tree. Terribly useful for creating non cohesive
desktops.
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-03-06 19:22:28 UTC (rev 73834)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2007-03-06 19:27:47 UTC (rev 73835)
@@ -6,6 +6,10 @@
valuechanged handler checks if skipped_nodes is equal to the new
value.
- Implement 2.0 Sort method.
+ - Add useless 2.0 DoubleBuffer property
+ - Implement 2.0 LineColors property. Lets you change the color of
+ the lines in the tree. Terribly useful for creating non cohesive
+ desktops.
2007-03-06 Jackson Harper <[EMAIL PROTECTED]>
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs
2007-03-06 19:22:28 UTC (rev 73834)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/TreeView.cs
2007-03-06 19:27:47 UTC (rev 73835)
@@ -83,6 +83,7 @@
private bool update_needed;
private Pen dash;
+ private Color line_color;
private StringFormat string_format;
private int drag_begin_x = 0;
@@ -142,7 +143,12 @@
#region Public Instance Properties
public override Color BackColor {
get { return base.BackColor;}
- set { base.BackColor = value; }
+ set {
+ base.BackColor = value;
+
+ CreateDashPen ();
+ Invalidate ();
+ }
}
@@ -464,6 +470,38 @@
}
}
+#if NET_2_0
+ /// According to MSDN this property has no effect on the
treeview
+ private bool double_buffered;
+ protected override bool DoubleBuffered {
+ get { return double_buffered; }
+ set { double_buffered = value; }
+ }
+#endif
+
+#if NET_2_0
+ public
+#else
+ private
+#endif
+ Color LineColor {
+ get {
+ if (line_color == Color.Empty) {
+ Color res = ControlPaint.Dark
(BackColor);
+ if (res == BackColor)
+ res = ControlPaint.Light
(BackColor);
+ return res;
+ }
+ return line_color;
+ }
+ set {
+ line_color = value;
+ if (show_lines) {
+ CreateDashPen ();
+ Invalidate ();
+ }
+ }
+ }
#endregion // Public Instance Properties
#region Protected Instance Properties
@@ -1065,15 +1103,18 @@
Draw (pe.ClipRectangle, pe.Graphics);
}
+ internal void CreateDashPen ()
+ {
+ dash = new Pen (LineColor, 1);
+ dash.DashStyle = DashStyle.Dot;
+ }
+
private void Draw (Rectangle clip, Graphics dc)
{
dc.FillRectangle
(ThemeEngine.Current.ResPool.GetSolidBrush (BackColor), clip);
- Color dash_color = ControlPaint.Dark (BackColor);
- if (dash_color == BackColor)
- dash_color = ControlPaint.Light (BackColor);
- dash = new Pen (dash_color, 1);
- dash.DashStyle = DashStyle.Dot;
+ if (dash == null)
+ CreateDashPen ();
Rectangle viewport = ViewportRectangle;
Rectangle original_clip = clip;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches