页边距修改

This commit is contained in:
艾竹
2023-01-24 20:51:39 +08:00
parent 1a291411e6
commit 66d3a6685b
11 changed files with 85 additions and 39 deletions

View File

@@ -387,18 +387,18 @@ namespace AIStudio.Wpf.DiagramDesigner
{
if (Root.GridCellSize.Width > this.ItemWidth)
{
this.Left = (int)(this.Left / Root.GridCellSize.Width) * Root.GridCellSize.Width + Root.GridMargin + (Root.GridCellSize.Width - this.ItemWidth) / 2;
this.Left = (int)(this.Left / Root.GridCellSize.Width) * Root.GridCellSize.Width + Root.GridMarginSize.Width + (Root.GridCellSize.Width - this.ItemWidth) / 2;
}
}
else if (Root.CellHorizontalAlignment == CellHorizontalAlignment.Left)
{
this.Left = (int)(this.Left / Root.GridCellSize.Width) * Root.GridCellSize.Width + Root.GridMargin;
this.Left = (int)(this.Left / Root.GridCellSize.Width) * Root.GridCellSize.Width + Root.GridMarginSize.Width;
}
else if (Root.CellHorizontalAlignment == CellHorizontalAlignment.Right)
{
if (Root.GridCellSize.Width > this.ItemWidth)
{
this.Left = (int)(this.Left / Root.GridCellSize.Width) * Root.GridCellSize.Width + Root.GridMargin + (Root.GridCellSize.Width - this.ItemWidth);
this.Left = (int)(this.Left / Root.GridCellSize.Width) * Root.GridCellSize.Width + Root.GridMarginSize.Width + (Root.GridCellSize.Width - this.ItemWidth);
}
}
@@ -406,18 +406,18 @@ namespace AIStudio.Wpf.DiagramDesigner
{
if (Root.GridCellSize.Height > this.ItemHeight)
{
this.Top = (int)(this.Top / Root.GridCellSize.Height) * Root.GridCellSize.Height + Root.GridMargin + (Root.GridCellSize.Height - this.ItemHeight) / 2;
this.Top = (int)(this.Top / Root.GridCellSize.Height) * Root.GridCellSize.Height + Root.GridMarginSize.Height + (Root.GridCellSize.Height - this.ItemHeight) / 2;
}
}
else if (Root.CellVerticalAlignment == CellVerticalAlignment.Top)
{
this.Top = (int)(this.Top / Root.GridCellSize.Height) * Root.GridCellSize.Height + Root.GridMargin;
this.Top = (int)(this.Top / Root.GridCellSize.Height) * Root.GridCellSize.Height + Root.GridMarginSize.Height;
}
else if (Root.CellVerticalAlignment == CellVerticalAlignment.Bottom)
{
if (Root.GridCellSize.Height > this.ItemHeight)
{
this.Top = (int)(this.Top / Root.GridCellSize.Height) * Root.GridCellSize.Height + Root.GridMargin + (Root.GridCellSize.Height - this.ItemHeight);
this.Top = (int)(this.Top / Root.GridCellSize.Height) * Root.GridCellSize.Height + Root.GridMarginSize.Height + (Root.GridCellSize.Height - this.ItemHeight);
}
}
}