当我在 FireMonkey 中运行时创建对象时,对象的侧面会显示一些线条。
下图是一个TLayout
。当我调整窗体大小或移动鼠标时,线条消失。这发生在TImage
、TRectangle
、TLayout
和其他组件中。
有人可以给我这个图形问题的解决方案吗?
TLayout
显示线条:
TLayout
调整表格大小后:
var
backRectangle: TRectangle;
category, title: TLabel;
icon: TImage;
bar: TRectangle;
background: TGridPanelLayout;
lay1, layicon: TLayout;
begin
backRectangle := TRectangle.Create(Self);
with backRectangle do
begin
Height := 150;
Align := TAlignLayout.top;
Fill.Color := Talphacolors.White;
Parent := Self;
Stroke.Thickness := 0;
Margins.Left := 20;
Margins.Top := 20;
Name := 'rectangle';
end;
background := TGridPanelLayout.Create(backRectangle);
with background do
begin
Parent := backRectangle;
Align := TAlignLayout.Client;
ColumnCollection.ClearAndResetID;
ColumnCollection.BeginUpdate;
with ColumnCollection.Add do
begin
Value := 100;
SizeStyle := TGridPanelLayout.TSizeStyle.Percent;
end;
ColumnCollection.EndUpdate;
RowCollection.Clear;
end;
lay1 := TLayout.Create(backRectangle);
lay1.Parent := backRectangle;
lay1.Align := TAlignLayout.client;
background.AddObject(lay1);
layicon := TLayout.Create(lay1);
layicon.Parent := lay1;
layicon.Align := TAlignLayout.client;
category := TLabel.Create(backRectangle);
with category do
begin
StyledSettings := [];
AutoSize := true;
Parent := lay1;
Align := TAlignLayout.None;
BeginUpdate;
TextSettings.BeginUpdate;
TextSettings.Font.Family := 'Roboto';
TextSettings.Font.Style := [TFontStyle.fsBold];
TextSettings.Font.Size := 16;
Text := 'category';
TextSettings.EndUpdate;
Margins.Left := 25;
Margins.Right := 0;
Margins.Bottom := 6;
Margins.Top:= 10;
TabOrder := 0;
end;
bar := TRectangle.Create(backRectangle);
bar.Width := 100;
bar.Height := 3;
bar.Fill.Color := $FF518CD2;
bar.Parent := lay1;
bar.Align := TAlignLayout.None;
bar.Stroke.Thickness := 0;
bar.Margins.Right := 20;
icon := timage.Create(layicon);
with icon do
begin
Parent := lay1;
Width := 30;
Margins.Left := 20;
Margins.Right := 20;
Margins.Bottom := 15;
Margins.Top := 45;
WrapMode := TImageWrapMode.fit;
Align := TAlignLayout.FitLeft;
try
Bitmap.LoadFromFile('icon');
except
end;
end;
title := TLabel.Create(layicon);
with title do
begin
StyledSettings := [];
Parent := lay1;
Text := '';
Align := TAlignLayout.Client;
TextSettings.Font.Family := 'Roboto';
TextSettings.Font.Style := [];
TextSettings.Font.Size := 16;
Margins.Left := 10;
TextSettings.VertAlign := TTextAlign.Center;
end;
bar.Align := TAlignLayout.Top;
category.Align := TAlignLayout.Top;
end;