Forum > LCL
Turn off String Grid red border of selected cell?
Josh:
I have not used stringgrid in a while, and am trying to remove the red line around a selected cell.
I have placed the following in ondraw event
I suspect I have forgot to turn off an option somewhere, as last time I used stringgrid ( 3+ years ago) i am sure I did not have this behaviour, and I no longer have the code.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.StringGrid1DrawCell(Sender: TObject; aCol, aRow: Integer; aRect: TRect; aState: TGridDrawState);begin With (sender as tstringgrid) Do Begin if not (grids.gdFixed in aState) then begin if not (grids.gdSelected in aState) then begin Canvas.Brush.Color :=$00710000; end else begin Canvas.Brush.Color := $002c8d31; end; end; font.color:=ClWhite; defaultdrawcell(Acol, Arow, arect, astate); end;end;
jamie:
maybe the Pen.Color is what you need?
canvas.Pen.Color := ????
Just a shot ..
Josh:
Hi
I have just tried pen.color and pen.width:=0 and still get the red border.
--- Code: ---canvas.Pen.Width:=0;
canvas.pen.color:=clwhite;
Canvas.Rectangle(aRect.Left - 1,aRect.Top - 1,aRect.Right +1,aRect.Bottom + 1);
--- End code ---
molly:
did you meant the focus rectangle josh ?
You should be able to check for that with gridstate gdFocused and draw according to your wishes (e.g. not draw the focus rectangle).
jamie:
the fact that u r calling the default drawing pretty much negates what you are doing.
How about not calling the default drawing if it was a focus rectangle drawing cycle ?
Navigation
[0] Message Index
[#] Next page