Einzelnen Beitrag anzeigen

Aviator

Registriert seit: 3. Jun 2010
1.611 Beiträge
 
Delphi 10.3 Rio
 
#2

AW: VirtualStringTree Drag & Drop

  Alt 2. Mär 2017, 15:04
Welche Version des VST verwendest du denn?

Ich habe jetzt nur mal in den Source der Version 6.4 reingeschaut. Dort habe ich nichts gesehen, was eine Zeichnung der DropMark aufhebt wenn MultiLine auf True steht. Lediglich wenn die Anwendung den Parameter CustomDraw im OnBeforeItemPaint Event auf True setzt wird das Zeichnen der Nodes übersprungen. Dann aber komplett.

Hast du eine kleine Beispielanwendung in der du das nachstellen kannst? Ich kann mir gerade keinen MultiLine Tree auf die Schnelle machen.

Das Zeichnen der DropMark wird in der Procedure DoPaintDropMark() ausgeführt. Die Procedure wird in der ganzen PaintRoutine nur einmal aufgerufen. Du könntest dir in dem Fall eine Ableitung des VST machen und die DoPaintDropMark() Procedure überschreiben. Virtual ist die Procedure auch. Sollte also daher kein Problem sein wenn du die eigentliche VST Version mal updatest.

Delphi-Quellcode:
procedure TBaseVirtualTree.DoPaintDropMark(Canvas: TCanvas; Node: PVirtualNode; R: TRect);

// draws the drop mark into the given rectangle
// Note: Changed properties of the given canvas should be reset to their previous values.

var
  SaveBrushColor: TColor;
  SavePenStyle: TPenStyle;

begin
  if FLastDropMode in [dmAbove, dmBelow] then
    with Canvas do
    begin
      SavePenStyle := Pen.Style;
      Pen.Style := psClear;
      SaveBrushColor := Brush.Color;
      Brush.Color := FColors.DropMarkColor;

      if FLastDropMode = dmAbove then
      begin
        Polygon([Point(R.Left + 2, R.Top),
                 Point(R.Right - 2, R.Top),
                 Point(R.Right - 2, R.Top + 6),
                 Point(R.Right - 6, R.Top + 2),
                 Point(R.Left + 6 , R.Top + 2),
                 Point(R.Left + 2, R.Top + 6)
        ]);
      end
      else
        Polygon([Point(R.Left + 2, R.Bottom - 1),
                 Point(R.Right - 2, R.Bottom - 1),
                 Point(R.Right - 2, R.Bottom - 8),
                 Point(R.Right - 7, R.Bottom - 3),
                 Point(R.Left + 7 , R.Bottom - 3),
                 Point(R.Left + 2, R.Bottom - 8)
        ]);
      Brush.Color := SaveBrushColor;
      Pen.Style := SavePenStyle;
    end;
end;
  Mit Zitat antworten Zitat