Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TVirtualStringTree - How to change the [-] / [+] buttons?

How can I use my own custom buttons (images) to replace the default [-]/[+] buttons in the VST?
I want to use arrows instead (enter image description here, enter image description here), but also to support RTL bidi mode (enter image description here, enter image description here).

edit: I am aware of the bsTriangle style (ButtonStyle). It does not respect RTL. I want to use my own custom images.

like image 601
ZigiZ Avatar asked May 17 '12 14:05

ZigiZ


1 Answers

Aren't those images usually in Windows Vista and Windows 7? The tree control should get them automatically on those systems when you have themes enabled.

The easy way to get something close to that is to just set the ButtonStyle property to bsTriangle. It won't be exactly the images shown in the question, though. The "minus" arrow will point straight down instead of diagonally, and the "plus" arrow will be solid instead of an outline.

You can provide your own bitmap. Change the VT_XPBUTTONMINUS and VT_XPBUTTONPLUS resources to whatever images you want, and set the ButtonFillMode property to fmShaded.

I see no facility for changing the image based on the bi-di mode, though. You can create a descendant class that overrides PaintNodeButton, and then paint whatever you want. Copy the placement code from the parent class.

like image 145
Rob Kennedy Avatar answered Sep 28 '22 08:09

Rob Kennedy