Hi,
I was forced to use ownerDrawText because I need to set the background color of the treeview node when the treeview is not focused.
But there is another problem when I enable this option:
You can see that the right-line of the checkbox rectangle is not visible (or is covered by the surface of node text?)
Is there a way to fix this?
ownerDrawText - checkboxes are messed
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
- ALIENQuake
- Posts: 112
- Last visit: Mon Jan 29, 2024 7:35 am
- Has voted: 4 times
Re: ownerDrawText - checkboxes are messed
Just do this:
Code: Select all
$treeview1_DrawNode=[System.Windows.Forms.DrawTreeNodeEventHandler]{
#Event Argument: $_ = [System.Windows.Forms.DrawTreeNodeEventArgs]
$_.Node.BackColor = 'Aqua'
}
- ALIENQuake
- Posts: 112
- Last visit: Mon Jan 29, 2024 7:35 am
- Has voted: 4 times
Re: ownerDrawText - checkboxes are messed
Well, it won't work because when the treeview is not focused, the node will have a 'grey' color, regardless of BackColor value.
Example of the same problem: https://stackoverflow.com/questions/211 ... ot-focused
I want to use the solution provided by stackoverflow but as I said, there is yet another problem with messed checkboxes.
Example of the same problem: https://stackoverflow.com/questions/211 ... ot-focused
I want to use the solution provided by stackoverflow but as I said, there is yet another problem with messed checkboxes.
Re: ownerDrawText - checkboxes are messed
Unfortunately there is no Paint event for nodes. That is where you would reset any node.
Also there is no way to understand what it is you are seeing without the code.
Also there is no way to understand what it is you are seeing without the code.