Home > Back-end >  FireMonkey HD form without DBgrid function, use TStringGrid DrawColumnCell, how to change the cell c
FireMonkey HD form without DBgrid function, use TStringGrid DrawColumnCell, how to change the cell c

Time:10-12

FireMonkey HD form without DBgrid function, use TStringGrid DrawColumnCell, how to change the cell color?
FM form how to make TStringGrid cell becomes angry,
For example code?

Who currently China has yet to give an answer?

CodePudding user response:

cattle people, such as online? Seems to be the most simple, D7 can realize, but can't XE2 FM?

CodePudding user response:

Can put the FMX. The Grid this unit, copy to your project directory, any modification,

CodePudding user response:

Put a TEdit control on the form, the right to modify the custom style, the one selected background, and change the Fill. The Color is the Color you want, then you can delete form the TEdit, reproduction FMX. Under the Grid to your project, do the following changes, it can realize the effect of interlaced discoloration, because each Grid in the Grid is a TEdit control, so the application code to make it our custom style, the key is this sentence: FCellControls [I] StyleLookup:='Edit1Style1';

Procedure TColumn. UpdateColumn;
Var
I, C, X: Integer;
V: the Variant;
The begin
If the Grid=nil then
The Exit;

FUpdateColumn:=True;
Try
{the Create controls}
If Length (FCellControls) & lt; Min (Grid. The RowCount, Grid. VisibleRows) then
The begin
C:=High (FCellControls);
SetLength (FCellControls, Min (Grid. The RowCount, Grid. VisibleRows));
For I:=C + 1 to Min (Grid. The RowCount, Grid VisibleRows) - 1 do
The begin
FCellControls [I] :=CreateCellControl;
The Parent FCellControls [I]=Self;
HitTest FCellControls [I]=False;
Visible FCellControls [I]=False;
Locked FCellControls [I]=True;
Stored FCellControls [I]=False;
If I mod 2=0 then
The begin
Edit1Style1 StyleLookup FCellControls [I]=' ';
end;
OnCanFocus FCellControls [I]=DoCanFocus;
OnEnter FCellControls [I]=DoEnter;
OnKeyDown FCellControls [I]=DoKeyDown;
end;
end;
  • Related