Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus-es / 2015-12

DBGrid

3 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Héctor Fiandor

Dear fellows:

I am using a DBGrid in a form. Some titles are too long and I want to write this line in a Multiline type. I have read the Grids Reference Page, but I can�t found how to do this.

I will appreciate any help.

Saludos,

Ing. H�ctor Fiandor

hfiandor en ceniai.inf.cu

------------ pr�xima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus-es/attachments/20151212/3a683f79/attachment.html>

Reply by email

francisco prieto
to Héctor Fiandor

Te trascribo una ayuda del foro Delphi...

Use "OnDrawColumnCell" event and put ';' inside the caption of the column between the two lines:

[DELPHI]procedure TForm2.DBGrid1DrawColumnCell(Sender: TObject; const Rect:
TRect;DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
S1, S2: String;
sCaption : String;
begin
sCaption := Column.Title.Caption;
with DBGrid1 do begin
Canvas.Brush.Style := bsClear;
if Pos(';',sCaption) = 0 then begin
s1 := sCaption;
s2 := '';
end else begin
s1 := Copy(sCaption,1,Pos(';',sCaption)-1);
s2 := Copy(sCaption,Pos(';',sCaption)+1,Length(sCaption)-Length(s1));
end;
Canvas.TextOut(Rect.Left+2, 2, S1);
Canvas.TextOut(Rect.Left+2, 16, S2);
end;
end;[/DELPHI]

Regards,
Abdulaziz Jasser

Saludos,

Pancho
C�rdoba
Argentina

2015-12-12 9:37 GMT-03:00 H�ctor Fiandor <hfiandor en ceniai.inf.cu>:

Show quoted text 28 lines
Dear fellows: I am using a DBGrid in a form. Some titles are too long and I want to write this line in a Multiline type. I have read the Grids Reference Page, but I can?t found how to do this. I will appreciate any help. Saludos, Ing. H�ctor Fiandor hfiandor en ceniai.inf.cu _______________________________________________ Lazarus-es mailing list Lazarus-es en lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus-es

------------ pr�xima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus-es/attachments/20151212/d9c8bedb/attachment.html>

Reply by email

Juan Perles
to francisco prieto

Hac�a tiempo que iba tras poder poner el nombre de una columna en dos l�neas. En una StringGrid s� que lo he conseguido, pero en una DbGrid no, as� que cuando v� la soluci�n dada a H�ctor la he probado, pero no me ha funcionado. S� que rellena las dos subcabeceras pero sigue sin tocar el t�tulo de la columna. No s� que estar� haciendo mal. A ver si a alguien le ha funcionado y me puede echar una mano. Muchas gracias por vuestra ayuda.

Juan Perles
628.482.007
Enviado desde mi iPad

Show quoted text 70 lines
El 12 dic 2015, a las 14:19, francisco prieto <fajprieto en gmail.com> escribi�: Te trascribo una ayuda del foro Delphi... Use "OnDrawColumnCell" event and put ';' inside the caption of the column between the two lines: [DELPHI]procedure TForm2.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;DataCol: Integer; Column: TColumn; State: TGridDrawState); var S1, S2: String; sCaption : String; begin sCaption := Column.Title.Caption; with DBGrid1 do begin Canvas.Brush.Style := bsClear; if Pos(';',sCaption) = 0 then begin s1 := sCaption; s2 := ''; end else begin s1 := Copy(sCaption,1,Pos(';',sCaption)-1); s2 := Copy(sCaption,Pos(';',sCaption)+1,Length(sCaption)-Length(s1)); end; Canvas.TextOut(Rect.Left+2, 2, S1); Canvas.TextOut(Rect.Left+2, 16, S2); end; end;[/DELPHI] Regards, Abdulaziz Jasser Saludos, Pancho C�rdoba Argentina 2015-12-12 9:37 GMT-03:00 H�ctor Fiandor <hfiandor en ceniai.inf.cu>: > Dear fellows: > > > > I am using a DBGrid in a form. Some titles are too long and I want to write this line in a Multiline type. I have read the Grids Reference Page, but I can?t found how to do this. > > > > I will appreciate any help. > > > > Saludos, > > Ing. H�ctor Fiandor > > hfiandor en ceniai.inf.cu > > > > > _______________________________________________ > Lazarus-es mailing list > Lazarus-es en lists.lazarus.freepascal.org > http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus-es _______________________________________________ Lazarus-es mailing list Lazarus-es en lists.lazarus.freepascal.org http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus-es

------------ pr�xima parte ------------
Se ha borrado un adjunto en formato HTML...
URL: <http://lists.lazarus.freepascal.org/pipermail/lazarus-es/attachments/20151220/854b5f45/attachment.html>

Reply by email