I am looking for a simple example to use TDirect2DCanvas for owner drawing each item of a listbox. Googling for DirectWrite gives the result to sample example to render text on the form. Being a student, my Delphi skill could not catch the tutorial properly. A simple example or a reference to draw text on a canvas would be a great start for me.
Here is the code(old classic method), I am trying to implement using DirectWrite:
procedure TForm2.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var
LB: TListBox;
begin
LB := TListBox(Control);
if odSelected in State then begin
LB.Canvas.Brush.Color := clPurple;
end;
LB.Canvas.FillRect(Rect);
LB.Canvas.TextOut(Rect.Left + 10, Rect.Top + 5, LB.Items[Index]);
end;