Truslew

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: TVirtualStringTree and multi line headers #41354
    Truslew
    Participant

    I created a fix that works for me. See code market with //HTG

    procedure TacVirtualTreeViewWnd.AdvancedHeaderDraw(Sender: TPersistent; var PaintInfo: THeaderPaintInfo; const Elements: THeaderPaintElements);


    if hpeDropMark in Elements then begin
    {$IFDEF TNTUNICODE}
    Text := GetWideStrProp(PaintInfo.Column, 'Text');
    {$ELSE}
    Text := GetStrProp(PaintInfo.Column, 'Text');
    {$ENDIF}
    if Text <> '' then begin
    TextRC := PaintInfo.TextRectangle;
    OffsetRect(TextRC, -PaintInfo.PaintRectangle.Left, -PaintInfo.PaintRectangle.Top);

    HeaderProp := GetObjProp(SkinData.FOwnerControl, 'Header');
    if HeaderProp <> nil then begin
    FontProp := GetObjProp(HeaderProp, 'Font');
    if FontProp <> nil then begin
    Bmp.Canvas.Font.Assign(TFont(FontProp));
    end;
    end;

    // HTG
    Flag:=DT_VCENTER or DT_END_ELLIPSIS;
    if WrapCaption(PaintInfo.Column) then
    Flag:=Flag + DT_WORDBREAK
    else
    Flag:=Flag + DT_SINGLELINE;

    acWriteTextEx(Bmp.Canvas, PacChar(Text), True, TextRC, Flag, Si, (State <> 0), DefaultManager);
    // HTG
    end;
    end;

    function TacVirtualTreeViewWnd.WrapCaption(Column: TCollectionItem): Boolean;
    begin
    Result:= Pos('coWrapCaption', GetSetProp(PaintInfo.Column, 'Options'))>0;
    end;

Viewing 1 post (of 1 total)