Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Componentes TMS (https://www.clubdelphi.com/foros/showthread.php?t=75242)

cheche358 08-08-2011 01:06:51

Componentes TMS
 
Esta va para quienes tengan los componentes de TMS...

Cual es el evento equivalente a DrawColumnCell en el TDBAdvGrid

gluglu 08-08-2011 11:22:47

OnDrawCell .... ;)

cheche358 08-08-2011 14:54:15

Pero ese evento no se comporta igual ni tiene los mismos argumentos, habria que hacer muchos cambios al codigo...

Luis M. 08-08-2011 17:32:14

Hola.
Si quieres poner un color a una línea en particular según el valor de un campo, en el evento onGetCellColor escribes algo así :

Código Delphi [-]
if ARow > 0 then
if DBGrid1.cells[6, ARow] = 'BAJA' then ABrush.Color:= $00BCA5B8;

Un saludo.

cheche358 08-08-2011 18:31:45

Gracias por responder, tengo codigo un poco mas elaborado...

Código:

procedure TForm3.jvdbgrd1DrawColumnCell(Sender: TObject; const Rect: TRect;
  DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
  r1, r2: TRect;
  s1, s2: string;
const
  clPaleGreen = TColor($CCFFCC);
  clPaleRed = TColor($CCCCFF);
begin
  if Column.Field.Dataset.FieldbyName('EXISTENCIA').AsInteger = 0 then
  begin
    if (gdFocused in State) then
      jvdbgrd1.canvas.brush.color := clGray
    else
      jvdbgrd1.Canvas.Brush.Color := clSilver;
      jvdbgrd1.Canvas.Font.Color := clBlack;
      jvdbgrd1.DefaultDrawColumnCell(rect, DataCol, Column, State);
  end
  else
    ;
  if Column.Field.Dataset.FieldbyName('EXISTENCIA').AsInteger > 0 then
  begin
    if (edt1.Text = '') or
      (Pos(UpperCase(edt1.Text),
      UpperCase(Column.Field.AsString)) <> 1) then
      exit;
    r1 := Rect;
    r2 := Rect;
    s1 := copy(Column.Field.AsString, 1, length(edt1.Text));
    jvdbgrd1.Canvas.FillRect(Rect);
    jvdbgrd1.Canvas.Font.Color := clRed;
    jvdbgrd1.Canvas.Font.Style := [fsbold];
    DrawText(jvdbgrd1.Canvas.Handle, PChar(s1), Length(s1), r1, DT_CALCRECT);
    jvdbgrd1.Canvas.TextOut(r1.Left, r2.Top, s1);
    jvdbgrd1.Canvas.Font.Assign(jvdbgrd1.Font);
    s2 := StringReplace(Column.Field.AsString, s1, '', []);
    r2.Left := r1.Right;
    DrawText(jvdbgrd1.Canvas.Handle, pchar(s2), length(s2), r2, 0);
  end
  else
    ;
end;

Estoy realmenbte perdido en hacer la conversion... :confused:

* La fila se pinta en Gris si la existencia es igual a 0.

* Las filas con existencia mayor a 0 se pinta dinamicamente con lo que se va escribiendo en el Edt1.


La franja horaria es GMT +2. Ahora son las 04:22:14.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi