Board index » delphi » TstringGrid blue cell!

TstringGrid blue cell!

Hello

I wonder if someone would know how to prevent a blue filled cell in the
grid to show when I include a TstringGrid in a form? When I put a
Tstringgrid in a form and then I run the application I get a blue cell!
How do I get rid of  it!

Thank you in advance.
Paulo

 

Re:TstringGrid blue cell!


Paulo,

I believe you're refering to the "focused" cell.  If you want the StringGrid to
never show a focused cell you can assign an event handler to
StringGrid1.OnDrawCell like:

procedure TForm1.StringGrid1DrawCell(Sender: TObject; Col, Row: Integer;
  Rect: TRect; State: TGridDrawState);
begin
  with StringGrid1 do begin
    Canvas.Brush.Color := Color;
    Canvas.Font.Assign(Font);
  end;
end;

This would reset the colors before the cell was drawn.  (You may also need to
set StringGrid1.DefaultDrawing to False - I forget).  Note that this will never
draw a focused cell.  

HTH - Mike

Quote
Paulo Pinheiro wrote:

> Hello

> I wonder if someone would know how to prevent a blue filled cell in the
> grid to show when I include a TstringGrid in a form? When I put a
> Tstringgrid in a form and then I run the application I get a blue cell!
> How do I get rid of  it!

> Thank you in advance.
> Paulo

--
  Michael Mount                
  I.S. Department              
  National Field Reps, Inc.    
  mi...@nationalfieldreps.com

Re:TstringGrid blue cell!


Quote
> I wonder if someone would know how to prevent a blue filled cell in the
> grid to show when I include a TstringGrid in a form? When I put a
> Tstringgrid in a form and then I run the application I get a blue cell!
> How do I get rid of  it!

remove selection from a grid:
Const
   NoSelection : TGridRect = (Left:-1; Top:-1; Right:-1; Bottom:-1 );

 grid.Selection := NoSelection;

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitly requested!

Other Threads