1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25:
| procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); begin with ListBox1.Canvas do if odSelected in State then begin Font.Color := ListBox1.Font.Color; Brush.Color := ListBox1.Color; FillRect(Rect); TextOut(Rect.Left+18,Rect.Top+2,ListBox1.Items[Index]); DrawFocusRect(Rect); DrawFocusRect(Classes.Rect(Rect.Left+16,Rect.Top,Rect.Right,Rect.Bottom)); DrawFrameControl(Handle, Classes.Rect(Rect.Left,Rect.Top,Rect.Left+16,Rect.Bottom), DFC_BUTTON,DFCS_BUTTONRADIO or DFCS_CHECKED); end else begin FillRect(Rect); DrawFrameControl(Handle, Classes.Rect(Rect.Left,Rect.Top,Rect.Left+16,Rect.Bottom), DFC_BUTTON,DFCS_BUTTONRADIO); TextOut(Rect.Left+18,Rect.Top+2,ListBox1.Items[Index]); end; end; |