Delphi Pages Forums

Delphi Pages Forums (http://www.delphipages.com/forum/index.php)
-   General (http://www.delphipages.com/forum/forumdisplay.php?f=2)
-   -   StringGrid again (disable highlight color of select area) (http://www.delphipages.com/forum/showthread.php?t=150553)

digitiger 11-11-2005 12:10 AM

StringGrid again (disable highlight color of select area)
 
I also need to disable the highlight color of the selected area inside the String gird but dont know as how to do it.

kindly help

Thanks a lot

mshkolnik 11-11-2005 12:34 AM

RE: StringGrid again (disable highlight color of select area)
 
1. exclude the soRangeSelect flag in Options property
2. write the next code in OnSelectCell event:
procedure TForm1.StringGrid1SelectCell(Sender: TObject; Col, Row: Integer; var CanSelect: Boolean);
begin
CanSelect := False
end;


With best regards, Mike Shkolnik
http://www.scalabium.com

PowerOrb 11-11-2005 04:18 AM

RE: StringGrid again (disable highlight color of select area)
 
Set the property DefaultDrawing of the stringgrid to false

on the OnDrawCell event insert this code:

procedure TForm1.GridDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
Grid.Canvas.Font := Grid.Font;
if (ACol < Grid.FixedCols) or (ARow < Grid.FixedRows) then
Grid.Canvas.Brush.Color := Grid.FixedColor
else
Grid.Canvas.Brush.Color := Grid.Color;

DrawText(Grid.Canvas.Handle, PChar(Grid.Cells[aCol, ARow]), -1, Rect, DT_SINGLELINE or DT_CENTER OR DT_VCENTER or DT_NOPREFIX);

end;

Best Regards!

__________________________________________________ ______

Sometimes it's hard to recognize what is reality and what is virtual.
__________________________________________________ ______


All times are GMT. The time now is 02:13 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.