[Lazarus-es] DBGrid

Juan Perles perlesj en gmail.com
Dom Dic 20 18:09:40 CET 2015


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

> 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-ide.org/pipermail/lazarus-es/attachments/20151220/854b5f45/attachment-0002.html>


More information about the Lazarus-es mailing list