Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 11-11-2005, 12:10 AM
digitiger digitiger is offline
Senior Member
 
Join Date: Jan 2001
Posts: 716
Default 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
Reply With Quote
  #2  
Old 11-11-2005, 12:34 AM
mshkolnik mshkolnik is offline
Senior Member
 
Join Date: Jul 2001
Posts: 4,195
Default 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
Reply With Quote
  #3  
Old 11-11-2005, 04:18 AM
PowerOrb PowerOrb is offline
Senior Member
 
Join Date: Jan 2002
Posts: 192
Default 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.
__________________________________________________ ______
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 01:27 AM.


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