Hi Tom, I wrote up a quick example ... if that would be of help. As i can't attach the files or post to the group section (don't have permission) i can send to your mail box direct.
Just let me know. Cheers, Charlie ----- Original Message ----- From: Nesler, Thomas J To: [email protected] Sent: Tuesday, April 24, 2007 8:40 AM Subject: [delphi-en] Setting background color of String grid row Hello! I am trying to highlight certain rows of a string grid based on different criteria. Whenever I work with the Win32 interface, I always get confused as to what is going on and what I should do. I realize I need to use the OnDrawCell event to take over the painting of the cell, but I can't seem to get the procedure to leave in the default attributes when I don't want to override the standard colors. Another point of confusion: If I Say Default drawing = false, does that mean I can turn on Default drawing after I am finished doing my custom work? All the examples I have seen so far, are very poorly documented (IMO) so they don't explain what is going on at all. Does anyone have a sample of code to do this? Here is my routine: procedure TForm1.XStrGrDailyDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState); Var OldColor : TColor; OldBrush : TBrush; begin with canvas do begin OldColor := Font.Color; //Save default Font color OldBrush := Brush; //Save default Brush brush.Style := bssolid; If ((ACol < XStrGrDaily.Fixedcols) OR (ARow < XStrGrDaily.FixedRows)) then //Ignore fixed rows If ApptArray[ARow] = False //Array that turns on color when true or turns off color when false then Begin Brush.Color := clwindow; canvas.Font.Style := []; end else Begin Brush.Color := clBlue; canvas.Font.Style := [fsbold]; end; FillRect(Rect); SetBkMode(Canvas.Handle,Transparent); TextOut(Rect.left+2,Rect.Top+2,XStrGrDaily.Cells[acol,arow]); //paint Cell Font.color := OldColor; brush := OldBrush; end; end; Thanks! Tom Nesler [Non-text portions of this message have been removed] [Non-text portions of this message have been removed]

