Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi stringgrid Zellenrahmen (https://www.delphipraxis.net/53956-stringgrid-zellenrahmen.html)

ibp 27. Sep 2005 09:24

Re: stringgrid Zellenrahmen
 
auf der Seite von TMS gibt es ein Beispiel!

Zitat:

TAdvStringGrid example 43 : advanced border control

In earlier versions of TAdvStringGrid, it was not possible to specify different border colors and widths for a single cell. It was only possible to specify which border to draw (left, top, bottom, right)

In addition to the OnGetCellBorder event with which you can specify which borders to draw, an extra event is now available, OnGetCellBorderProp through which the pen can be set for the left, top, bottom and right border of the cell.

How the 2 events work together is shown in the following example:


procedure TForm1.AdvStringGrid1GetCellBorder(Sender: TObject; ARow,
ACol: Integer; APen: TPen; var Borders: TCellBorders);
begin
if not Odd(ACol) and (ARow > 0) and (ACol > 0) then
begin
Borders := [cbLeft];
APen.Width := 1;
APen.Color := clBlack;
end;

if not Odd(ARow) and (ARow > 0) and (ACol > 0) then
begin
Borders := Borders + [cbBottom];
APen.Width := 1;
APen.Color := clBlack;
end;
end;

The above event handler makes sure that a left and bottom border of the cell are only drawn for all even rows. The specify that the left border should be drawn in a blue color and the bottom border in a red color, the OnGetCellBorderProp method is used :

procedure TForm1.AdvStringGrid1GetCellBorderProp(Sender: TObject; ARow,
ACol: Integer; LeftPen, TopPen, RightPen, BottomPen: TPen);
begin
LeftPen.Color := clBlue;

BottomPen.Color := clRed;
end;

ibp 28. Sep 2005 16:14

Re: stringgrid Zellenrahmen
 
und wie hast du es nun gelöst?

Matthias-k 29. Sep 2005 08:57

Re: stringgrid Zellenrahmen
 
hi ibp,

zu meiner svchande muss ich gestehen, das ich es noch nicht probieren konnte!

ich habs allerdings mal kurz in meiner pause antesten können! schaut interesannt aus!

muss ich allerdings erst unter laufzeit bedingungen testen!


dank dir aber!

hatte mir die tips auch durchgeschaut von tms, aber hab des komplett übersehen!

Matthias


Alle Zeitangaben in WEZ +1. Es ist jetzt 05:33 Uhr.
Seite 2 von 2     12   

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