Link to home
Start Free TrialLog in
Avatar of drama22
drama22

asked on

how do i remove white background in node inside virtual TVirtualStringTree?

i am currently try to remove node background white color i try to use TargetCanvas.Brush.Style := bsClear; inside BeforeCellPaint event but the white background of node still visible how do i remove that white back ground color of node ? here what i tried

procedure TForm2.VTs1BeforeCellPaint(Sender: TBaseVirtualTree;   TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;   CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect); 
var Data: PUData;
 begin
 Data := VTS1.GetNodeData(Node);
  if not Assigned(Node) then Exit;
 TargetCanvas.Brush.Style := bsClear;
 end;

Open in new window

Avatar of MerijnB
MerijnB
Flag of Netherlands image

What do you mean with remove, what should be in the background of the cell?
Avatar of drama22
drama22

ASKER

there is white color in the cell i don't want this color to be showing see the image

 look here
procedure TForm1.VirtualStringTree1BeforeCellPaint(Sender: TBaseVirtualTree;
  TargetCanvas: TCanvas; Node: PVirtualNode; Column: TColumnIndex;
  CellPaintMode: TVTCellPaintMode; CellRect: TRect; var ContentRect: TRect);
begin
    TargetCanvas.Brush.Color := clRed;
    TargetCanvas.FillRect(CellRect);
end;
Avatar of drama22

ASKER

this is not transparent this i will fill red color i don't want color at all
Seems that there is no transparency setting for TVirtualStringTree node Backgrounds.

The only way I can think of to simulate transparency for VirtualStringTree cells, is to copy convenient bitmap portions onto the canvas, so that it looks like the cell background is transparent.

Check this for further help
http://www.codegur.net/5567536/how-do-i-create-nodes-with-transparent-backgrounds-in-a-tvirtualdrawtree
Avatar of drama22

ASKER

i read this before on stackoverflow  i cannot apply the steps of the answer  can you help me with it ?
ASKER CERTIFIED SOLUTION
Avatar of Thommy
Thommy
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of drama22

ASKER

I fail to apply the bitbit part can you show me full delphi sample with no color nodes ? I doubt this is not what I need
Avatar of drama22

ASKER

****** looks like very hard to find a way :) ******
Set Background (property - TPicture) of VirtualStringTree ....

VirtualStringTree.Background.LoadFromFile(...);

Open in new window

Avatar of drama22

ASKER

Whats vts background picture has to do with cell node ? This will not help at all ,

also @thomas      BitBlt(TargetCanvas.Handle, 0, 0, MyBmp.Width, MyBmp.Height, MyBmp.Canvas.Handle , 0, 0,
SRCCOPY);

did not work at all or even a bit
Avatar of drama22

ASKER

accepted because its gives me idea to solve . thank Thomas