600) this.width = 600;">
procedure TRadioListBoxForm.FormCreate(Sender: TObject) ;
begin
//or use Object Inspector to assign the
//OnDrawItem event handler,
//Style and ItemHeight properties...
ListBox1.Style := lbOwnerDrawFixed;
ListBox1.ItemHeight := 20;
ListBox1.OnDrawItem := ListBox_DrawItem;
end;
procedure TRadioListBoxForm.ListBox_DrawItem(
Control: TWinControl;
Index: Integer;
Rect: TRect;
State: TOwnerDrawState) ;
const
IsSelected : array[Boolean] of Integer = (DFCS_BUTTONRADIO, DFCS_BUTTONRADIO or DFCS_CHECKED) ;
var
optionButtonRect: TRect;
listBox : TListBox;
begin
listBox := Control as TListBox;
with listBox.Canvas do
begin
FillRect(rect) ;
optionButtonRect.Left := rect.Left + 1;
optionButtonRect.Right := Rect.Left + 13;
optionButtonRect.Bottom := Rect.Bottom;
optionButtonRect.Top := Rect.Top;
DrawFrameControl(Handle, optionButtonRect, DFC_BUTTON, IsSelected[odSelected in State]) ;
TextOut(15, rect.Top + 3, listBox.Items[Index]) ;
end;
end;