Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Coloboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #4  
Antiguo 16-04-2014
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Poder: 38
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola Luvac.

A ver... fijate si te sirve de este modo:
Código Delphi [-]
...
type
  TStringGrid = class(Grids.TStringGrid)
  private
    FRowSelected: Integer;
  protected
    function CreateEditor: TInplaceEdit; override;
  public
    property RowSelected: Integer read FRowSelected write FRowSelected;
  end;

  TForm1 = class(TForm)
    StringGrid1: TStringGrid;
    procedure FormCreate(Sender: TObject);
    procedure StringGrid1Enter(Sender: TObject);
    procedure StringGrid1SelectCell(Sender: TObject; ACol, ARow: Integer;
      var CanSelect: Boolean);
    procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
      Rect: TRect; State: TGridDrawState);
    ...
  private
  public
  end;
...

implementation

{ TStringGrid }
function TStringGrid.CreateEditor: TInplaceEdit;
begin
  Result := inherited CreateEditor;
  if Focused then
    TMaskEdit(Result).Font.Color := clRed
  else
    TMaskEdit(Result).Font.Color := clBlack;
end;

{ TForm }
procedure TForm1.FormCreate(Sender: TObject);
begin
   ...
end;

procedure TForm1.StringGrid1Enter(Sender: TObject);
begin
  TStringGrid(Sender).RowSelected:= -1;
end;

procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
const
  ROWCOL : array[Boolean] of TColor = (clBlack, clRed);
begin
  with TStringGrid(Sender) do
  begin
    Canvas.Font.Color:= ROWCOL[ARow = RowSelected];
    Canvas.TextOut(Rect.Left+2, Rect.Top+2, Cells[Acol,ARow]);
  end;
end;

procedure TForm1.StringGrid1SelectCell(Sender: TObject; ACol,
  ARow: Integer; var CanSelect: Boolean);
begin
  with TStringGrid(Sender) do
  begin
    RowSelected:= ARow;
    Invalidate;
  end;
end;
...

Saludos
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Problema al alinear texto en StringGrid en XE adrall OOP 0 21-06-2011 11:58:05
Centrar texto StringGrid mizzard C++ Builder 17 11-05-2011 23:20:38
StringGrid doble fila mjjj Varios 3 11-07-2008 16:19:08
Escanear Doble Cara, Doble Lector karenthyuliana Gráficos 2 11-04-2008 17:29:42
alinear a la derecha texto de un stringgrid ctronx Varios 10 07-09-2007 21:54:59


La franja horaria es GMT +2. Ahora son las 04:10:28.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi