Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Mark Rideouts treeGridView - Exapand Glyph missing if DPI > 100%

$
0
0

I noticed there's an issue with the expand\collapse glynph not displaying when the DPI is set to anything other than 100% (Windows 7\8)

Glyph's are drawn in TreeGridCell.cs:

          if (node.HasChildren || node._grid.VirtualNodes)
            {
                // Ensure that visual styles are supported. 
                if (Application.RenderWithVisualStyles)
                {
                    VisualStyleRenderer rOpen = new VisualStyleRenderer(VisualStyleElement.TreeView.Glyph.Opened);
                    VisualStyleRenderer rClosed = new VisualStyleRenderer(VisualStyleElement.TreeView.Glyph.Closed);

                    // Paint node glyphs	
                    if (node.IsExpanded)
                        //node._grid.rOpen.DrawBackground(graphics, new Rectangle(glyphRect.X, glyphRect.Y + (glyphRect.Height / 2) - 4, 10, 10)); 
                        rOpen.DrawBackground(graphics, new Rectangle(glyphRect.X, glyphRect.Y + (glyphRect.Height / 2) - 4, 10, 10));
                    else
                        //node._grid.rClosed.DrawBackground(graphics, new Rectangle(glyphRect.X, glyphRect.Y + (glyphRect.Height / 2) - 4, 10, 10)); 
                        rClosed.DrawBackground(graphics, new Rectangle(glyphRect.X, glyphRect.Y + (glyphRect.Height / 2) - 4, 10, 10));
                }
                else
                {
                    int h = 8;
                    int w = 8;
                    int x = glyphRect.X;
                    int y = glyphRect.Y + (glyphRect.Height / 2) - 4;
                    //MessageBox.Show("x = " + x.ToString() + ", y= " + y.ToString()); 

                    graphics.DrawRectangle(new Pen(SystemBrushes.ControlDark), x, y, w, h);
                    graphics.FillRectangle(new SolidBrush(Color.White), x + 1, y + 1, w - 1, h - 1);
                    graphics.DrawLine(new Pen(new SolidBrush(Color.Black)), x + 2, y + 4, x + w - 2, y + 4);

                    if (!node.IsExpanded)
                        graphics.DrawLine(new Pen(new SolidBrush(Color.Black)), x + 4, y + 2, x + 4, y + h - 2);
                }
            } 
But I'm not sure how this is affected by changing the DPI? What part of the above is affected by the DPI change?

http://blogs.msdn.com/b/markrideout/archive/2006/01/08/customizing-the-datagridview-to-support-expanding-collapsing-ala-treegridview.aspx

(The link is no longer working on Mark's blog, here's the control: http://www.filedropper.com/treegridviewrebuilt)


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>