105067 调整窗口位置

This commit is contained in:
SINVO\yangshunli 2025-01-15 10:58:23 +08:00
parent 6bed559bfe
commit e4320a34e9
1 changed files with 12 additions and 0 deletions

View File

@ -27,6 +27,18 @@ namespace Sinvo.EplanHpD.Plugin.WPFUI.View
public ScannerInfo(ScannerViewModel scannerViewModel) public ScannerInfo(ScannerViewModel scannerViewModel)
{ {
InitializeComponent(); InitializeComponent();
Rect workArea = SystemParameters.WorkArea;
this.Top = workArea.Bottom - this.Height;
// 如果需要,也可以设置窗口水平居中
this.Left = (workArea.Width - this.ActualWidth) / 6;
// 确保窗口在屏幕范围内(如果屏幕很小,上面的设置可能会导致窗口部分在屏幕外)
// 这通常不是必需的,但可以作为额外的安全检查
if (this.Top < 0)
{
this.Top = 0;
}
_scannerViewModel = scannerViewModel; _scannerViewModel = scannerViewModel;
this.DataContext = _scannerViewModel; this.DataContext = _scannerViewModel;
this.Topmost = true; this.Topmost = true;