Recent

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

Pe3s

  • Sr. Member
  • ****
  • Posts: 332
[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: 634
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: 761
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 2.3.0 documentation at: https://dsiders.gitlab.io/lazdocsnext

paweld

  • Hero Member
  • *****
  • Posts: 557
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

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

 

TinyPortal © 2005-2018