Ver Mensaje Individual
  #2  
Antiguo 07-04-2015
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
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 Lenny.

La verdad es que no sé si terminé de comprender claramente la situación... De lo que entendí, no veo que relación pueda tener el evento OnDrawColumnCell con lo que buscas hacer.
Si deseas mostrar la unión de nombre-apellido en una columna, podes hacerlo al momento de cargar el TStringGrid desde la tabla de tu bd.

Un ejemplo de lo que te digo con la tabla CLIENTS que trae Delphi de facto:
Código Delphi [-]
procedure TForm1.FormCreate(Sender: TObject);
var
  SG: TStringGrid;
begin
  SG := StringGrid1;
  SG.FixedRows := 1;
  SG.RowCount  := 2;
  SG.ColCount  := 3;
  SG.ColWidths[2] := 200;
  SG.Rows[0].CommaText := 'FirstName,LastName,FullName';
  with Query1 do
  begin
    Close;
    SQL.Clear;
    SQL.Add('SELECT FIRST_NAME, LAST_NAME,');
    SQL.Add('FIRST_NAME+'' ''+LAST_NAME AS FULL_NAME FROM CLIENTS');
    Open;
    while not Eof do
    begin
      SG.Cells[0,SG.RowCount-1] := FieldByName('FIRST_NAME').AsString;
      SG.Cells[1,SG.RowCount-1] := FieldByName('LAST_NAME').AsString;
      SG.Cells[2,SG.RowCount-1] := FieldByName('FULL_NAME').AsString;
      SG.RowCount:= SG.RowCount + 1;
      Next;
    end;
  end;
end;
Si deseas realizar la concatenación desde Delphi, reemplaza estas líneas:
Código Delphi [-]
...
    SQL.Text := 'SELECT FIRST_NAME, LAST_NAME FROM CLIENTS';
...

    SG.Cells[2,SG.RowCount-1] := FieldByName('FIRST_NAME').AsString + ' ' +
                                 FieldByName('LAST_NAME').AsString;
...

Resultado del ejemplo:



Saludos
__________________
Daniel Didriksen

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