Back to Devexpress

TdxTreeViewCustomDrawEvent Type

vcl-dxtreeview-5fb23363.md

latest2.0 KB
Original Source

TdxTreeViewCustomDrawEvent Type

The custom draw procedural type for the Tree View control.

Declaration

delphi
TdxTreeViewCustomDrawEvent = procedure(Sender: TdxCustomTreeView; ACanvas: TcxCanvas; AViewInfo: TdxTreeViewViewInfo; var AHandled: Boolean) of object;

Parameters

NameTypeDescription
SenderTdxCustomTreeView

The Tree View control that raised a custom draw event.

| | ACanvas | TcxCanvas |

The Sender Tree View control’s canvas.

| | AViewInfo | TdxTreeViewViewInfo |

The Tree View control’s ViewInfo information.

| | AHandled | Boolean |

Assign True to this parameter if you override the Tree View control’s built-in draw routine. Do not change the parameter value if you only need to complement the built-in draw routine with custom draw operations.

|

Remarks

The following OnCustomDraw event handler changes the default background color of the Tree View to blue:

delphi
procedure TForm1.dxTreeViewControl1CustomDraw(Sender: TdxCustomTreeView;
  ACanvas: TcxCanvas; AViewInfo: TdxTreeViewViewInfo; var AHandled: Boolean);
begin
  ACanvas.Brush.Color := clSkyBlue;
  ACanvas.FillRect(AViewInfo.Bounds);
end;
cpp
void __fastcall TForm1::dxTreeViewControl1CustomDraw(TdxCustomTreeView *Sender,
  TcxCanvas *ACanvas, TdxTreeViewViewInfo *AViewInfo, bool &AHandled)
{
  ACanvas->Brush->Color = clSkyBlue;
  ACanvas->FillRect(AViewInfo->Bounds);
}

The Tree View’s OnCustomDraw event references the TdxTreeViewCustomDrawEvent type.

See Also

dxTreeView Unit