titulo duplo em dbgrig

Delphi

14/12/2005

Galera como faço titulo duplo em um dbgrig?

assim:
______________________________________________________
|         PRODUTOS              |   ESTOQUE   |  LOCALIZAÇÃO | 
|Código|Descrição |Cod. Fábrica |Real sistema |Lado|Posição  | 
-------------------------------------------------------------------
| 0001 |Oleo     |0ddd00        | 10       10 | 12   45   | 
| 0002 |Fluido   |5677kkk       | 456    567  | 67 43   |


thanks


Marcos Fernando

Marcos Fernando

Curtidas 0

Respostas

Adriano Santos

Adriano Santos

14/12/2005

Um exemplo bem tosco pra vc ter uma ideia:

procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
  S1, S2: String;
begin
  with TCGrid(TDBGrid(Sender)) do
  begin
    RowHeights[0] := 32;
    Canvas.Brush.Style := bsClear;
    Canvas.Font.Color := clBlack;
    Column.Title.Caption := ´´;
    case Column.Index of
    0: begin
         S1 := ´Nome do´;
         S2 := ´País´;
       end;
    1: begin
         S1 := ´Nome da´;
         S2 := ´Capital´;
       end;
    2: begin
         S1 := ´Nome do´;
         S2 := ´Continente´;
       end;
    3: begin
         S1 := ´Área´;
         S2 := ´Total´;
       end;
    4: begin
         S1 := ´Total´;
         S2 := ´População´;
       end;
    end;
    Canvas.TextOut(Rect.Left+2,  2, S1);
    Canvas.TextOut(Rect.Left+2, 16, S2);
    DefaultDrawColumnCell(Rect, DataCol, Column, State);
  end;
end;

procedure TForm1.DBGrid1ColEnter(Sender: TObject);
begin
  DBGrid1.Refresh;
end;



GOSTEI 0
POSTAR