Recent

Author Topic: [SOLVED] DBGrid remove red rectangle selection  (Read 692 times)

Pe3s

  • Hero Member
  • *****
  • Posts: 533
[SOLVED] DBGrid remove red rectangle selection
« on: December 06, 2022, 05:58:25 pm »
Hello, is it possible to remove the red rectangle from the active selection?
« Last Edit: December 08, 2022, 06:56:25 am by Pe3s »

Nicole

  • Hero Member
  • *****
  • Posts: 970
Re: DBGrid remove red rectangle selection
« Reply #1 on: December 06, 2022, 06:57:51 pm »
yes

write into the event

DBGrid1ColumnCell(Sender: TObject;
   const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);

Code: Pascal  [Select][+][-]
  1.       if (gdSelected in State) then Canvas.Font.Color:= clBlue;
« Last Edit: December 06, 2022, 07:01:01 pm by Nicole »

dsiders

  • Hero Member
  • *****
  • Posts: 1077
Re: DBGrid remove red rectangle selection
« Reply #2 on: December 06, 2022, 09:29:27 pm »
Hello, is it possible to remove the red rectangle from the active selection?

The focus rectangle gets drawn when DefaultDrawing is enabled. You can turn DefaultDrawing off and provide you own OnDraw* handlers.

Or you can change FocusColor to a color more pleasing to you.
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

paweld

  • Hero Member
  • *****
  • Posts: 991
Re: DBGrid remove red rectangle selection
« Reply #3 on: December 06, 2022, 11:18:20 pm »
https://lazarus-ccr.sourceforge.io/docs/lcl/grids/tcustomgrid.focusrectvisible.html
Code: Pascal  [Select][+][-]
  1. DBGrid1.FocusRectVisible := Fasle;
  2.  
Best regards / Pozdrawiam
paweld

Pe3s

  • Hero Member
  • *****
  • Posts: 533
Re: DBGrid remove red rectangle selection
« Reply #4 on: December 08, 2022, 06:56:06 am »
Thank you  :)

 

TinyPortal © 2005-2018