相关疑难解决方法(0)

Delphi XE2 风格绘画

在绘制 VCL 样式的窗口元素时,我遇到了绘制不正确的角的问题。在具有圆角的样式上,我在控件的边界矩形和样式的圆角窗口角之间的空间中得到一个白色背景。

在此处输入图片说明

上图是使用 Aqua Light Slate 运行的,但任何带有圆角的样式都会出现同样的问题。我错过了什么?

type
  TSample = class(TCustomControl)
  protected
    procedure Paint; override;
  end;

{ TForm1 }
procedure TForm1.FormCreate(Sender: TObject);
var
  R: TRect;
  S: TSample;
begin
  R := ClientRect;
  InflateRect(R, -20, -20);
  S := TSample.Create(Application);
  S.Parent := Self;
  S.BoundsRect := R;
end;

{ TSample }
procedure TSample.Paint;
var
  Details: TThemedElementDetails;
begin
  Details := StyleServices.GetElementDetails(twCaptionActive);
  StyleServices.DrawParentBackground(Self.Handle, Canvas.Handle, Details, False);
  StyleServices.DrawElement(Canvas.Handle, Details, ClientRect);
end;
Run Code Online (Sandbox Code Playgroud)

delphi delphi-xe2 vcl-styles

3
推荐指数
1
解决办法
2113
查看次数

标签 统计

delphi ×1

delphi-xe2 ×1

vcl-styles ×1