开发者

how to make the TreeView backcolor transparent?

开发者 https://www.devze.com 2023-03-12 11:37 出处:网络
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 ?

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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号