This commit is contained in:
ShrlAlgo
2025-07-11 09:20:23 +08:00
parent c7b104f44f
commit 4d35cadb56
840 changed files with 102347 additions and 11595 deletions

View File

@@ -137,54 +137,55 @@ public partial class ToastControl : UserControl
ownerWidth = SystemParameters.WorkArea.Size.Width * DpiHelper.ScaleX;
ownerHeight = SystemParameters.WorkArea.Size.Height * DpiHelper.ScaleY;
}
popup.HorizontalOffset = (ownerWidth - popupWidth) / 2d;
popup.VerticalOffset = toast.OffsetMargin.Top + offset.Top;
//switch (toast.Location)
//{
// case ToastLocation.Center:
// popup.HorizontalOffset = (ownerWidth - popupWidth) / 2d;
// popup.VerticalOffset = (ownerHeight - popupHeight) / 2d;
// break;
switch (toast.Location)
{
case ToastLocation.Center:
popup.HorizontalOffset = (ownerWidth - popupWidth) / 2d;
popup.VerticalOffset = (ownerHeight - popupHeight) / 2d;
break;
// case ToastLocation.Left:
// popup.HorizontalOffset = offset.Left;
// popup.VerticalOffset = (ownerHeight - popupHeight) / 2d;
// break;
case ToastLocation.Left:
popup.HorizontalOffset = offset.Left;
popup.VerticalOffset = (ownerHeight - popupHeight) / 2d;
break;
// case ToastLocation.Right:
// popup.HorizontalOffset = ownerWidth - popupWidth - offset.Right;
// popup.VerticalOffset = (ownerHeight - popupHeight) / 2d;
// break;
case ToastLocation.Right:
popup.HorizontalOffset = ownerWidth - popupWidth - offset.Right;
popup.VerticalOffset = (ownerHeight - popupHeight) / 2d;
break;
// case ToastLocation.TopLeft:
// popup.HorizontalOffset = offset.Left;
// popup.VerticalOffset = toast.OffsetMargin.Top + offset.Top;
// break;
case ToastLocation.TopLeft:
popup.HorizontalOffset = offset.Left;
popup.VerticalOffset = toast.OffsetMargin.Top + offset.Top;
break;
// case ToastLocation.TopCenter:
// popup.HorizontalOffset = (ownerWidth - popupWidth) / 2d;
// popup.VerticalOffset = toast.OffsetMargin.Top + offset.Top;
// break;
case ToastLocation.TopCenter:
popup.HorizontalOffset = (ownerWidth - popupWidth) / 2d;
popup.VerticalOffset = toast.OffsetMargin.Top + offset.Top;
break;
// case ToastLocation.TopRight:
// popup.HorizontalOffset = ownerWidth - popupWidth - offset.Right;
// popup.VerticalOffset = toast.OffsetMargin.Top + offset.Top;
// break;
case ToastLocation.TopRight:
popup.HorizontalOffset = ownerWidth - popupWidth - offset.Right;
popup.VerticalOffset = toast.OffsetMargin.Top + offset.Top;
break;
// case ToastLocation.BottomLeft:
// popup.HorizontalOffset = offset.Left;
// popup.VerticalOffset = ownerHeight - popupHeight - offset.Bottom;
// break;
case ToastLocation.BottomLeft:
popup.HorizontalOffset = offset.Left;
popup.VerticalOffset = ownerHeight - popupHeight - offset.Bottom;
break;
// case ToastLocation.BottomCenter:
// popup.HorizontalOffset = (ownerWidth - popupWidth) / 2d;
// popup.VerticalOffset = ownerHeight - popupHeight - offset.Bottom;
// break;
case ToastLocation.BottomCenter:
popup.HorizontalOffset = (ownerWidth - popupWidth) / 2d;
popup.VerticalOffset = ownerHeight - popupHeight - offset.Bottom;
break;
case ToastLocation.BottomRight:
popup.HorizontalOffset = ownerWidth - popupWidth - offset.Right;
popup.VerticalOffset = ownerHeight - popupHeight - offset.Bottom;
break;
}
// case ToastLocation.BottomRight:
// popup.HorizontalOffset = ownerWidth - popupWidth - offset.Right;
// popup.VerticalOffset = ownerHeight - popupHeight - offset.Bottom;
// break;
//}
}
public void Close()