[mapguide-commits] r6880 - branches/2.4/MgDev/Desktop/MapViewer

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Mon Jul 9 02:06:03 PDT 2012


Author: jng
Date: 2012-07-09 02:06:02 -0700 (Mon, 09 Jul 2012)
New Revision: 6880

Modified:
   branches/2.4/MgDev/Desktop/MapViewer/MgLegend.cs
Log:
#2066: Render expander for owner drawn nodes that have children

Modified: branches/2.4/MgDev/Desktop/MapViewer/MgLegend.cs
===================================================================
--- branches/2.4/MgDev/Desktop/MapViewer/MgLegend.cs	2012-07-09 08:46:07 UTC (rev 6879)
+++ branches/2.4/MgDev/Desktop/MapViewer/MgLegend.cs	2012-07-09 09:06:02 UTC (rev 6880)
@@ -712,7 +712,18 @@
                 //For some reason, the default bounds are way off from what you would
                 //expect it to be. So we apply this offset for any text/image draw operations
                 int xoffset = -36;
+                if (trvLegend.ShowPlusMinus && e.Node.Nodes.Count > 0)
+                {
+                    // Use the VisualStyles renderer to use the proper OS-defined glyphs
+                    Rectangle expandRect = new Rectangle(e.Node.Bounds.X - 52, e.Node.Bounds.Y, 16, 16);
 
+                    VisualStyleElement element = (e.Node.IsExpanded) ? 
+                        VisualStyleElement.TreeView.Glyph.Opened : VisualStyleElement.TreeView.Glyph.Closed;
+
+                    VisualStyleRenderer renderer = new VisualStyleRenderer(element);
+                    renderer.DrawBackground(e.Graphics, expandRect);
+                }
+
                 if ((e.State & TreeNodeStates.Selected) == TreeNodeStates.Selected)
                 {
                     backColor = SystemColors.Highlight;



More information about the mapguide-commits mailing list