Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   ¿como poner dbgrid titulo de colmna en negritas cuando seleciona columna? (https://www.clubdelphi.com/foros/showthread.php?t=85785)

JXJ 05-05-2014 02:56:34

¿como poner dbgrid titulo de colmna en negritas cuando seleciona columna?
 
Hola

¿como se puede hacer que cuando una celda esta selecionada ya sea con un click
o por desplazarse por el dbgrid con las teclas de las flechas,

el titulo se ponga en negritas y el resto de los titulos, se mantengan sin negritas?

este comportamiento lo vi en el ib manager para firebird de la empresa EMS
www.ibmanager.net

realmente ayuda a saber en que registro estas posicionado.

gracias.

ecfisa 05-05-2014 03:30:35

Hola JXJ.

Código Delphi [-]
...
implementation

var
  PrevInx: Integer = 0;

procedure BoldTitle(Grid: TDBGrid; Inx: Integer);
begin
  with Grid do
  begin
    Columns.Items[PrevInx].Title.Font.Style:= [];
    Columns.Items[Inx].Title.Font.Style:= [fsBold];
    PrevInx:= Inx;
  end;
end;

procedure TForm1.DBGrid1Enter(Sender: TObject);
begin
  BoldTitle(DBGrid1, PrevInx);
end;

procedure TForm1.DBGrid1ColEnter(Sender: TObject);
begin
  BoldTitle(DBGrid1, DBGrid1.SelectedIndex);
end;

procedure TForm1.DBGrid1CellClick(Column: TColumn);
begin
  BoldTitle(DBGrid1, DBGrid1.SelectedIndex);
end;

Saludos :)

JXJ 05-05-2014 21:16:00

wowo. muchas gracias. eficsa.

nunca se me habia ocurrido hacerlo asi.


La franja horaria es GMT +2. Ahora son las 20:05:29.

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