How to change the border color (or remove the border) of a PropertyGrid control?
.net, c#, propertygrid, winforms
Solution
this is another alternative, as it seems that my first answer is not suitable for this particular control. This is a dirty trick but should work:
Put a Panel control in your window or dialog, let say with size 100H x 300V. Put the propertygrid inside the panel with position -1,-1 and size 102,302.
Problem
Having a standard WinForms 2.0 `PropertyGrid` control I'm looking for a way to either change the border color of the control or remove the border altogether. I'm aware of the `LineColor` property which unfortunately only changes the inner borders between the cells. Additionally, I used ILSpy to take a look at the source code of the `PropertyGrid` control and still found nothing meaningful to me. My question is: How to remove the outer border of a `PropertyGrid` control or change the color of the outer border? Update 2012-05-04 - Solution (aka "hack"): Based on Jamie's answer I assembled a working solution (which you can download from here): The idea is to place the property grid inside a panel and let the panel clip the control. With this approach, I did place the clipping panel into another panel that has a `Padding` of "1" (or whatever you want the borders to be) and gave this panel a `BackColor` that serves as the border color (green in my example). Set the Anchor of the property grid to "Left, Right, Top, Bottom", set the `Dock` of the clipping panel to "Full". This works well for my requirements. I would see this as kind of a hack since it consumes the resources of two panels which I hoped I could save.