Back to Devexpress

TdxTreeViewCustomDrawNodeEvent Type

vcl-dxtreeview-a94b0921.md

latest2.1 KB
Original Source

TdxTreeViewCustomDrawNodeEvent Type

The custom draw procedural type for tree nodes.

Declaration

delphi
TdxTreeViewCustomDrawNodeEvent = procedure(Sender: TdxCustomTreeView; ACanvas: TcxCanvas; ANodeViewInfo: TdxTreeViewNodeViewInfo; var AHandled: Boolean) of object;

Parameters

NameTypeDescription
SenderTdxCustomTreeView

The Tree View control that raised a custom draw event for a node.

| | ACanvas | TcxCanvas |

The Sender Tree View control’s canvas.

| | ANodeViewInfo | TdxTreeViewNodeViewInfo |

ViewInfo information on the drawn tree node.

| | AHandled | Boolean |

Assign True to this property to override the built-in node draw routine. Do not change this parameter value if you only need to add custom draw operations to the built-in routine.

|

Remarks

The following OnCustomDrawNode event handler applies the italic font attribute to a selected node’s caption:

delphi
procedure TForm1.dxTreeViewControl1CustomDrawNode(Sender: TdxCustomTreeView;
  ACanvas: TcxCanvas; ANodeViewInfo: TdxTreeViewNodeViewInfo;
  var AHandled: Boolean);
begin
  if ANodeViewInfo.Node.Selected then
    ACanvas.Font.Style := ACanvas.Font.Style + [fsItalic];
end;
cpp
void __fastcall TForm1::dxTreeViewControl1CustomDrawNode(TdxCustomTreeView *Sender,
  TcxCanvas *ACanvas, TdxTreeViewNodeViewInfo *ANodeViewInfo, bool &AHandled)
{
  if (ANodeViewInfo->Node->Selected)
    ACanvas->Font->Style = ACanvas->Font->Style << fsItalic;
}

The Tree View’s OnCustomDrawNode event references the TdxTreeViewCustomDrawNodeEvent type.

See Also

dxTreeView Unit