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]

Reply via email to