Einzelnen Beitrag anzeigen

dopeline

Registriert seit: 7. Mär 2003
Ort: Berlin
304 Beiträge
 
Delphi 7 Enterprise
 
#1

OnDrawCell eines StringGrids in DLL auslagern...

  Alt 13. Feb 2004, 16:46
Hallo!

ich habe ein problem:

ich habe folgendes im OnDrawCell-Ereignis des StringGrids stehen: (durch diesen code wird die markierte zeile etwas schöner dargestellt, als sonst 8) )
Delphi-Quellcode:
procedure TFormHaupt.SGPDrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
var Grid: TStringGrid;
    oldalign : word;
begin

 begin
  Grid := Sender as TStringGrid;

   if gdSelected in State then
    begin
     Grid.Canvas.Font.Color := clBlack;
     Grid.Canvas.Brush.Color := RGB(215, 238, 255);
     Grid.Canvas.Font.Style := [fsBold];
    end else Grid.Canvas.Brush.Color := Grid.Color;
     Grid.Canvas.TextRect(Rect, Rect.Left + 2, Rect.Top + 2, Grid.Cells[ACol, ARow]);
 end;
begin
 if (aRow = 0) and not (gdFixed In State) then
  begin
   with (sender as tstringgrid).canvas do
    begin
      Pen.Color := clBlack;
      Pen.Width := 2;
      Pen.Style := psSolid;
      MoveTo( rect.left-1, rect.bottom );
      Lineto( rect.right-1, rect.bottom );
    end;
  end;
end;
if (aRow=0) then
 begin
  Grid.canvas.font.style := Grid.canvas.font.style + [fsbold];
 end;
 if (aRow=0) then
  begin
   Grid.canvas.font.Size:= 10;
   Grid.Canvas.Brush.Color := RGB(238, 238, 238);
   Grid.Canvas.FillRect(Rect);
  end;

  begin
  oldalign:=settextalign(Grid.canvas.handle,ta_left);
  Grid.canvas.textrect(rect,rect.left+2,rect.top+2, Grid.cells[aCol,aRow]);
  settextalign(Grid.canvas.handle,oldalign);
  end;
end;
da ich viele stringgrids habe und ich sowieso schon einige prozeduren in einer dll ausgelagert habe, möchte ich dieses ereignis auch in die dll verschieben. allerdings funktioniert das nicht so wirklich....

Hat jemand einen Rat?


Gruß, dopeline
  Mit Zitat antworten Zitat