how to make the TreeView backcolor transparent?
im trying to place treeview on UserControl and when im trying to set the TreeView backcolor to tran开发者_开发技巧sparent i got error, there is another way to do it ?
thanks in advance,
shachar.
TreeView
does not support transparent background color. You're best option is to just set the background color of the TreeView
to that of the TreeView
's parent container.
Handle the BackColorChanged
event on the UserControl and set the TreeView
bg color to the TreeView bg color in the event handler.
private void treeViewParent_BackColorChanged(object sender, EventArgs e)
{
treeView1.BackColor = treeViewParent.BackColor;
}
There is nothing called transparent background for a windows treeview control. But you can play around with some method like OnPaint or OnPaintBackground. This link could help: http://msdn.microsoft.com/en-us/library/1e430ef4(vs.71).aspx#Y798
精彩评论