Ver Mensaje Individual
  #10  
Antiguo 02-12-2009
cloayza cloayza is offline
Miembro
 
Registrado: may 2003
Ubicación: San Pedro de la Paz, Chile
Posts: 915
Reputación: 23
cloayza Tiene un aura espectacularcloayza Tiene un aura espectacular
Prueba este codigo...

Pagina del Autor: http://delphi.about.com/od/adptips20...diolistbox.htm

Código Delphi [-]
procedure TForm1.FormCreate(Sender: TObject);
begin
   ListBox1.Style := lbOwnerDrawFixed;
   ListBox1.MultiSelect:=False; //Al desactivar la multiseleccion funciona como un TRadioButton, seleccionando un item a la vez.
   ListBox1.ItemHeight := 20;
   ListBox1.OnDrawItem := ListBox1DrawItem;
end;

procedure TForm1.ListBox1DrawItem(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;
Eso no mas...
Responder Con Cita