Okay now you can chortle. Now I have got the Left and Top the correct way around it looks good. Thanks everyone, got there in the end. I'll now add the TextHeight/Width adjustments and remove the constants as suggested.
I still say some of the affects caused by the inaccurate X,Y...
Okay, I have tried changing the code along the lines Andrew (Hamps) suggests and its different. I do now get text in cells when I scroll down but not in all cells. I am guessing the simple Top+4 and Left+4 needs tweaking so I'll look at the definitions for these values and tweak away!
Andy
Okay, I understand that BUT that does not explain why Text gets written successfully sometimes when I scroll up quickly but not when slowly. I mean here for a cell where it once displayed successfully it then doesn't show text! Anyway I'll try the alteration becuase it is clearly simply and...
The Grid has 101 rows and on first showing it is as expected but you scroll down and there is no text in the rows that were not initially visible but the cells have been coloured as expected. Scroll back up and sometimes you get all the text, others only some of it! I have tried it with...
I have written a simple single form exmaple and am convinced the problem is related to the scrolling. ANyway here is the DrawCell procedure:
procedure TTestStringGrids.StringGridDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
var
X, Y : integer...
Thaks for your persistance. I understand what you say but it does not explain why when the cells are visiblt the FillRect works but not the TextRect for the same cell. I will double check my logic that works out how a cell is to be painted. It is just that it seems to correctly work out, for...
In my DrawGrid event handler it paints each cell's canvas by setting the Brush.Color and then using Canvas.FillRect to colour the cell and followed by setting the Font.Color and calling Canvas.TextRect to add text. This works fine for all visible cells but the text isn't painted on the cells...
I am using the StringGridDrawCell to do the Canvas painting. The colouring of the cells works fine all the way through the Grid down into the cells not visible but the TextRect written text does not show up on the non visible cells. I do still have stuff in the FormShow to fill the cells which...
Great, I have used similar to colour rows in a String Grid but when there is a scroll bar on the Grid the Text put into Cells not visible does not get added. I am guessing I need to add something to the scroll event handler to redraw the text in the Cells newly visible? DOes that sound right...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.