Cor de seleção
Alguém sabe como alterar a cor de seleção do DBGrid?
Quando posicionamos o cursor em uma célula ela geralmente fica azul com fonte branca. Tem como mudar isso?
Quando posicionamos o cursor em uma célula ela geralmente fica azul com fonte branca. Tem como mudar isso?
Okama
Curtidas 0
Respostas
Carnette
28/03/2003
Alguém sabe como alterar a cor de seleção do DBGrid?
Quando posicionamos o cursor em uma célula ela geralmente fica azul com fonte branca. Tem como mudar isso?
Tem sim amiguinho...Pega o 750 dicas e truques do lloydsoft que tem vários exemplos..
www.lloydsoft.hpg.ig.com.br
GOSTEI 0
Okama
28/03/2003
Legal, gostei das dicas, mas como faz para alterar a cor de seleção do DBGrid??
No 750 dicas encontrei tudo sobre cor em Grid, Zebrar, Colorir aleatóriamente. Bom isso eu já tô fazendo, agora imagine que eu vá colorir ´todas´ as células com a cor azul e a fonte branca.
Como eu poderia diferenciar onde está o cursor?
No 750 dicas encontrei tudo sobre cor em Grid, Zebrar, Colorir aleatóriamente. Bom isso eu já tô fazendo, agora imagine que eu vá colorir ´todas´ as células com a cor azul e a fonte branca.
Como eu poderia diferenciar onde está o cursor?
GOSTEI 0
Carnette
28/03/2003
Legal, gostei das dicas, mas como faz para alterar a cor de seleção do DBGrid??
No 750 dicas encontrei tudo sobre cor em Grid, Zebrar, Colorir aleatóriamente. Bom isso eu já tô fazendo, agora imagine que eu vá colorir ´todas´ as células com a cor azul e a fonte branca.
Como eu poderia diferenciar onde está o cursor?
TGridDrawState represents information that is useful when rendering the cell of a grid.
Unit
Classes
type
TGridDrawState = set of (gdSelected, gdFocused, gdFixed);
Description
TGridDrawState represents state information about the cell of a grid that is being rendered. It is a set that includes 0 or more of the following:
ValueMeaning
gdSelectedThe cell is currently selected.
gdFocusedThe cell has input focus.
gdFixedThe cell is in the fixed region of the grid.
GOSTEI 0
Okama
28/03/2003
procedure TFormEVENTO.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
with DBGrid1.Canvas do begin
Case Table1.FieldByName(´Campo´).AsInteger of
1:Brush.Color := clMoneyGreen;
2:Brush.Color := RGB(255,255,160);
3:Brush.Color := RGB(255,100,100);
end;
[b:dbf3ecba64]if gdSelected in State then
Brush.Color := clBlue;[/b:dbf3ecba64]
FillRect(Rect);
TextOut (Rect.Left + 2, Rect.Top + 2, Column.Field.AsString);
end;
end;
Valeu Carnette!
const Rect: TRect; DataCol: Integer; Column: TColumn;
State: TGridDrawState);
begin
with DBGrid1.Canvas do begin
Case Table1.FieldByName(´Campo´).AsInteger of
1:Brush.Color := clMoneyGreen;
2:Brush.Color := RGB(255,255,160);
3:Brush.Color := RGB(255,100,100);
end;
[b:dbf3ecba64]if gdSelected in State then
Brush.Color := clBlue;[/b:dbf3ecba64]
FillRect(Rect);
TextOut (Rect.Left + 2, Rect.Top + 2, Column.Field.AsString);
end;
end;
Valeu Carnette!
GOSTEI 0