Autor Beitrag
hansg
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 168

Win XP Professional SP3, Vista Ultimate 32 SP1
Delphi 6 Professional
BeitragVerfasst: Di 01.11.05 20:34 
Hallo zusammen,

ich habe ein Stringgrid mit 4 Spalten und 100 Zeilen.
In der ersten Zeile steht jeweils die Überschrift der einzelnen Spalten.
Jetzt möchte ich zusätzlich noch eine große Zeile mit einer Zeile als Gesamtüberschrift oben plazieren.

Geht das überhaupt?


Gruß Hans

_________________
Gruß Hans
Keldorn
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 2266
Erhaltene Danke: 4

Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
BeitragVerfasst: Di 01.11.05 20:36 
gehen tut das, aber es ist recht kompliziert. Problem ist z.B. das scrollen, such mal im Forum nach Suche in: Delphi-Forum, Delphi-Library ZELLEN VERBINDEN oder Suche in: Delphi-Forum, Delphi-Library COLSPAN, da gibt es einige ansätze.

Mfg Frank

_________________
Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Di 01.11.05 21:17 
Hallo,

user profile iconKeldorn hat folgendes geschrieben:
gehen tut das, aber es ist recht kompliziert. Problem ist z.B. das scrollen, ...
genau, das kann man wohl sagen :!:

Bei einem ähnlichen Vorhaben bin ich vor längerer Zeit auf folgende Idee gekommen:

Die Eigenschaft FixedRow des StringGrids auf 2 gestellt,
diese zusätzliche Zeile wird dann im Folgenden überdeckt.
Ein HeaderControl auf die Form gepackt und in etwa folgenden Code ausgeführt:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
  HeaderControl1.Sections.Add;
  HeaderControl1.Sections[0].Text := 'Die lange Überschrift';
  HeaderControl1.Sections[0].Alignment := taCenter;
  HeaderControl1.Sections[0].AllowClick := False;
  HeaderControl1.Top := StringGrid1.Top+2;
  HeaderControl1.Left := StringGrid1.Left+2;
  HeaderControl1.Height := StringGrid1.RowHeights[0]+1;
  HeaderControl1.Width := StringGrid1.ColWidths[0]
                         +StringGrid1.ColWidths[1]
                         +StringGrid1.ColWidths[2]
                         +StringGrid1.ColWidths[3]+4;
  HeaderControl1.Sections[0].Width := HeaderControl1.Width;

Das Ergebnis siehe Screenshot in der Anlage.

Ps.: Auf den Sectionen des HeaderControls kannst man übrigens mittels OnDrawSection auch selbst zeichnen.
Einloggen, um Attachments anzusehen!
_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )