| Kaf Dağı | 27 Mart 2015 15:33 | listbox nesnesinde seçili öğenin rengini değiştirmek Kod:
//Listbox'ın style özelliği lbOwnerDrawFixed olmalı
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect:
TRect; State: TOwnerDrawState);
begin
if odFocused in State then
begin
ListBox1.Canvas.Brush.Color := clRed;
ListBox1.Canvas.Font.Color := clYellow;
ListBox1.Canvas.Font.Style := [fsBold];
end;
ListBox1.Canvas.FillRect(Rect);
ListBox1.Canvas.TextOut(Rect.Left,Rect.Top,ListBox1.Items[Index]);
end;
-------------------------------------------------------------------------------
//listbox'taki en son öğeye scroll yapma
SendMessage(ListBox1.Handle,lb_SetTopIndex,2,0); |