I need the image is below the text, but always remains above: How i can fix it? (see the attach selectgrid.png).
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Grids,
DBGrids;
type
{ TForm1 }
TForm1 = class(TForm)
StringGrid1: TStringGrid;
procedure StringGrid1DrawCell(Sender: TObject; aCol, aRow: Integer;
aRect: TRect; aState: TGridDrawState);
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
Bitmap1: TBitmap;
Bitmap2: TBitmap;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.StringGrid1DrawCell(Sender: TObject; aCol, aRow: Integer;
aRect: TRect; aState: TGridDrawState);
begin
if (aCol = 0) or (aRow = 0) then begin
StringGrid1.Canvas.StretchDraw(aRect,Bitmap2);
end;
if gdSelected in aState then begin
StringGrid1.Canvas.StretchDraw(aRect,Bitmap1);
end;
StringGrid1.Cells[aCol,aRow] := 'Hello';
end;
initialization
Bitmap1 := TBitmap.Create;
Bitmap1.LoadFromFile('gradient.bmp');
Bitmap2 := TBitmap.Create;
Bitmap2.LoadFromFile('gradient2.bmp');
end.