Forum > Databases

OnDrawColumnTitle, how does it works?

(1/1)

hamacker:
OnDrawColumnTitle, how does it works?
I try code bellow like OnDrawColumnCell, but it does not work - empty title cell.

procedure TfmLista_Colaborador.Grade_PesquisaDrawColumnTitle(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
  if DataCol=0 then
  begin
    Canvas.FillRect(Rect); // limpando a celula com rect vazio
    imagelist_colGrids.Draw(Canvas,
      Rect.CenterPoint.x-(imagelist_colGrids.Width div 2),
      Rect.CenterPoint.y-(imagelist_colGrids.Height div 2),
      4); // imageindex
  end; 

loaded:
Hi,

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.DBGrid1DrawColumnTitle(Sender: TObject; const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);begin     with (Sender as TDBGrid) do     begin       if DataCol mod 2=0 then       begin       Canvas.Brush.Color:=clYellow;       Canvas.FillRect(Rect);       Canvas.TextOut(Rect.Left,Rect.Top,Datasource.DataSet.Fields[DataCol].FieldName);       end;     end;end;

hamacker:
Can not draw a picture instead Text?

loaded:
Certainly ;

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.DBGrid1DrawColumnTitle(Sender: TObject; const Rect: TRect;DataCol: Integer; Column: TColumn; State: TGridDrawState);  var    buf:Tbitmap;begin     with (Sender as TDBGrid) do     begin       if DataCol mod 2=0 then       begin       buf:=Tbitmap.Create;       ImageList1.GetBitmap(0, buf);       canvas.Draw(Rect.Left,Rect.Top,buf);       Canvas.TextOut(buf.Width+ Rect.Left,Rect.Top,Datasource.DataSet.Fields[DataCol].FieldName);       buf.Free;       end;     end;end;  

Navigation

[0] Message Index

Go to full version