The default ListBox items alignment is LeftJustify. There is no Object
Inspector property to change this, so if we need to right justify items,
we must use a simple trick.
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); var l: Integer; t: String; begin with ListBox1 do begin Canvas.FillRect(Rect); t := Items[Index]; l := Rect.Right - Canvas.TextWidth(t) - 1; Canvas.TextOut(l, Rect.Top, t); end; end;
Δεν υπάρχουν σχόλια:
Δημοσίευση σχολίου