Adicione um TListBox no seu formulário e alguns itens na propriedade Items, eu coloquei o seguinte :
Brasil
Argentina
Chile
Uruguai
Altere a propriedade Style do TListBox para lbOwnerDrawVariable .
Vamos usar um evento bem conhecidos o OnDrawItem.
Listagem 1: Desenhando o Item com o TRadioButton
procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer;
Rect: TRect; State: TOwnerDrawState);
var
drawRect: TRect;
begin
with ListBox1.Canvas do
begin
FillRect(rect);
drawRect.Left := rect.Left + 1;
drawRect.Right := Rect.Left + 13;
drawRect.Bottom := Rect.Bottom;
drawRect.Top := Rect.Top;
if odSelected in State then
DrawFrameControl(Handle, drawRect, DFC_BUTTON, DFCS_BUTTONRADIO or DFCS_CHECKED)
else
DrawFrameControl(Handle, drawRect, DFC_BUTTON, DFCS_BUTTONRADIO);
TextOut(15, rect.Top + 3, ListBox1.Items[Index]);
end;
end;
Veja o resultado:
Fico por aqui e até o próximo artigo
Um abraço
Wesley Y