procedure TForm.AdvancedHeaderDraw(Sender: TVTHeader; var PaintInfo: THeaderPaintInfo;
const Elements: THeaderPaintElements);
var
rNormalText, rResultText, rBemerkung, rTypWachstum: TRect;
x, y: Integer;
Text: WideString;
Size: TSize;
begin
inherited;
if (hpeText in Elements) then
begin
// Trennlinien zeichnen
if (PaintInfo.Column.Index >= abDieserSpalte) then
begin
rNormalText := PaintInfo.PaintRectangle;
InflateRect(rNormalText, 0, -1);
OffsetRect(rNormalText, -1, -1);
if (PaintInfo.IsDownIndex) then
OffsetRect(rNormalText, 1, 1);
PaintInfo.TargetCanvas.Pen.Color := clInactiveBorder;
PaintInfo.TargetCanvas.Pen.Width := 1;
// Trennlinie Ansatz und typ. Wachstum
y := rNormalText.Top;
y := y + ((rNormalText.Bottom - rNormalText.Top) div 3);
PaintInfo.TargetCanvas.MoveTo(rNormalText.Left, y);
PaintInfo.TargetCanvas.LineTo(rNormalText.Right, y);
// Trennlinie typ. Wachstum und Rest
y := rNormalText.Top;
y := y + (((rNormalText.Bottom - rNormalText.Top) div 3) * 2) + (FrameVSTTestItemList.Tree.TextMargin div 2);
PaintInfo.TargetCanvas.MoveTo(rNormalText.Left, y);
PaintInfo.TargetCanvas.LineTo(rNormalText.Right, y);
x := rNormalText.Left + leftPartWidth;
PaintInfo.TargetCanvas.MoveTo(x, y);
PaintInfo.TargetCanvas.LineTo(x, rNormalText.Bottom);
end;
// Bereiche berechnen
rNormalText := PaintInfo.PaintRectangle;
InflateRect(rNormalText, -PaintInfo.Column.Margin, 0);
if (PaintInfo.IsDownIndex) then
OffsetRect(rNormalText, 1, 1);
// Normalen Text bestimmen und berechnen
Text := PaintInfo.Column.Text;
GetTextExtentPoint32W(PaintInfo.TargetCanvas.Handle, PWideChar(Text), Length(Text), Size);
if (PaintInfo.Column.Index > -1) and (Size.cx > (rNormalText.Right - rNormalText.Left)) then
Text := ShortenString(PaintInfo.TargetCanvas.Handle, Text, (rNormalText.Right - rNormalText.Left), 0);
SetBkMode(PaintInfo.TargetCanvas.Handle, TRANSPARENT);
SetTextColor(PaintInfo.TargetCanvas.Handle, ColorToRGB(clWindowText));
if (PaintInfo.Column.Index >= abDieserSpalte) then
begin
Windows.DrawTextW(PaintInfo.TargetCanvas.Handle, PWideChar(Text),
Length(Text), rNormalText, DT_LEFT or DT_TOP or DT_NOPREFIX or DT_SINGLELINE);
OffsetRect(rNormalText, 0, -2);
// typ. Wachstum zeichnen
rTypWachstum := rNormalText;
Text := 'typ. Wachstum';
GetTextExtentPoint32W(PaintInfo.TargetCanvas.Handle, PWideChar(Text), Length(Text), Size);
if (PaintInfo.Column.Index > -1) and (Size.cx > (rTypWachstum.Right - rTypWachstum.Left)) then
Text := ShortenString(PaintInfo.TargetCanvas.Handle, Text, (rTypWachstum.Right - rTypWachstum.Left), 0);
Windows.DrawTextW(PaintInfo.TargetCanvas.Handle, PWideChar(Text),
Length(Text), rTypWachstum, DT_LEFT or DT_VCENTER or DT_NOPREFIX or DT_SINGLELINE);
// unteren Bereich zeichnen
rResultText := rNormalText;
//rResultText.Right := rResultText.Left + ((rResultText.Right-rResultText.Left) div 2) - PaintInfo.Column.Margin;
rResultText.Right := rResultText.Left + leftPartWidth - PaintInfo.Column.Margin;
Text := 'Kultur';
GetTextExtentPoint32W(PaintInfo.TargetCanvas.Handle, PWideChar(Text), Length(Text), Size);
if (PaintInfo.Column.Index > -1) and (Size.cx > (rResultText.Right - rResultText.Left)) then
Text := ShortenString(PaintInfo.TargetCanvas.Handle, Text, (rResultText.Right - rResultText.Left), 0);
Windows.DrawTextW(PaintInfo.TargetCanvas.Handle, PWideChar(Text),
Length(Text), rResultText, DT_LEFT or DT_BOTTOM or DT_NOPREFIX or DT_SINGLELINE);
rBemerkung := rNormalText;
//rBemerkung.Left := rBemerkung.Left + ((rBemerkung.Right-rBemerkung.Left) div 2) + PaintInfo.Column.Margin;
rBemerkung.Left := rBemerkung.Left + leftPartWidth + PaintInfo.Column.Margin;
Text := 'Bemerkung';
GetTextExtentPoint32W(PaintInfo.TargetCanvas.Handle, PWideChar(Text), Length(Text), Size);
if (PaintInfo.Column.Index > -1) and (Size.cx > (rBemerkung.Right - rBemerkung.Left)) then
Text := ShortenString(PaintInfo.TargetCanvas.Handle, Text, (rBemerkung.Right - rBemerkung.Left), 0);
Windows.DrawTextW(PaintInfo.TargetCanvas.Handle, PWideChar(Text),
Length(Text), rBemerkung, DT_LEFT or DT_BOTTOM or DT_NOPREFIX or DT_SINGLELINE);
end else
begin
// Normalen Text ausgeben
Windows.DrawTextW(PaintInfo.TargetCanvas.Handle, PWideChar(Text),
Length(Text), rNormalText, DT_LEFT or DT_VCENTER or DT_NOPREFIX or DT_SINGLELINE);
end;
end;
end;