Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi OnDrawCell eines StringGrids in DLL auslagern... (https://www.delphipraxis.net/16249-ondrawcell-eines-stringgrids-dll-auslagern.html)

dopeline 13. Feb 2004 16:46


OnDrawCell eines StringGrids in DLL auslagern...
 
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


Alle Zeitangaben in WEZ +1. Es ist jetzt 15:45 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz