LCL: TTreeView: Win32 Fixed warning TResourceCacheItem.IncreaseRefCount 1000 TPenHandleCache. Issue #30661

git-svn-id: trunk@55118 -
This commit is contained in:
michl 2017-05-29 06:25:28 +00:00
parent 9ce286c99d
commit dd3f611b28
3 changed files with 11 additions and 0 deletions

View File

@ -3315,6 +3315,7 @@ type
FTopItem: TTreeNode;
FTreeLineColor: TColor;
FTreeLinePenStyle: TPenStyle;
FTreeLinePenPattern: TPenPattern;
FExpandSignColor : TColor;
FTreeNodes: TTreeNodes;
FHintWnd: THintWindow;

View File

@ -3264,6 +3264,9 @@ begin
FStates:=[tvsMaxLvlNeedsUpdate,tvsMaxRightNeedsUpdate,tvsScrollbarChanged];
FTreeLineColor := clWindowFrame;
FTreeLinePenStyle := psPattern;
SetLength(FTreeLinePenPattern, 2);
FTreeLinePenPattern[0] := 1;
FTreeLinePenPattern[1] := 1;
FExpandSignColor := clWindowFrame;
// Accessibility
AccessibleDescription := rsTTreeViewAccessibilityDescription;
@ -5220,6 +5223,8 @@ begin
// draw tree lines
Pen.Color := TreeLineColor;
Pen.Style := TreeLinePenStyle;
if Pen.Style = psPattern then
Pen.SetPattern(FTreeLinePenPattern);
x := DrawTreeLines(Node);
Pen.Style := psSolid;

View File

@ -1352,6 +1352,11 @@ begin
LB.lbColor := ColorToRGB(TColor(lplb.lbColor));
LB.lbHatch := lplb.lbHatch;
Result := Windows.ExtCreatePen(dwPenStyle, dwWidth, LB, dwStyleCount, lpStyle);
// Note Michl: When style PS_USERSTYLE is used, lpStyle can't be nil, there
// must be dwSytleCount >= 1, see issue #30661
if Result = 0 then
DebugLn('TWin32WidgetSet.ExtCreatePen returns 0. Reason = ' + GetLastErrorText(Windows.GetLastError));
end;
{------------------------------------------------------------------------------