Ver Mensaje Individual
  #3  
Antiguo 24-06-2017
petercat petercat is offline
Miembro
 
Registrado: feb 2012
Posts: 23
Reputación: 0
petercat Va por buen camino
Gracias mallet, pero el componente TAdvStringGridveo que es de pago y ya me he hecho yo mi procedure para que me funcionelo pongo aqui por si a alguien le hace falta.
Cuento las lineas de grid que tengo [T], [i] es otro integer que yo utilizo un numero determinado, y [H] es una division que utilizo para pintar la linea por debajo.
Realmente lo que conseguimos es pintar todo el cuado del grid en color ClBlack y lo reducimos por arriba utilizando (MyRect.Bottom := MyRect.Top + 3y por abajo (MyRect.Top := MyRect.Bottom - 3) las variables T,I,H son donde quiero hacer el recuadro, tambien los podemos ace en el ColLines con (Column.Index) donde 1 puede ser una variable mas.

Código Delphi [-]
type
  MyTDBGrid = class(TDBGrid);

procedure TFTecladoDetalle.DBGrid1DrawColumnCell(Sender: TObject;
  const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
  MyCanvas: TCanvas;
  MyColor: TColor;
  MyRect: TRect;
  T, i,h :Integer;

begin
T := DBGrid1.DataSource.DataSet.RecordCount;
I :=4;
H := T div I;


  if Column.Index mod 1 = 0 then begin
    MyCanvas := DBGrid1.Canvas;
    MyColor :=  DBGrid1.Canvas.Brush.Color;
    DBGrid1.Canvas.Brush.Color := clblack;//DBGrid1.Color;
    MyRect := Rect;
//    Inc(MyRect.Right); // QUITO EL COLLINES EN EL GRID Y COMENTO ESTO
    MyRect.Left := MyRect.Right - 3;  //GROSOR DE LA LINEA
    MyCanvas.FillRect(MyRect);
    if MyTDBGrid(DBGrid1).DataLink.ActiveRecord mod H = 0 then begin

      MyRect := Rect;
//      Inc(MyRect.Bottom); // QUITO EL ROWLINES EN EL GRID Y COMENTO ESTO
      MyRect.Bottom := MyRect.Top + 3;  //GROSOR DE LA LINEA
      MyCanvas.FillRect(MyRect);
    end;
    if MyTDBGrid(DBGrid1).DataLink.ActiveRecord mod T = T-1 then begin
      MyRect := Rect;
//      Inc(MyRect.Bottom); // QUITO EL ROWLINES EN EL GRID Y COMENTO ESTO
      MyRect.Top := MyRect.Bottom - 3;  //GROSOR DE LA LINEA
      MyCanvas.FillRect(MyRect);
    end;
    DBGrid1.Canvas.Brush.Color := MyColor;
  end;


end;
Responder Con Cita