在绘制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;
StyleServices.DrawElement
方法以查看它如何在画布上绘制位图? - RRUZ