mirror of
https://github.com/LorisYounger/VPet.git
synced 2024-08-30 18:42:36 +00:00
支持窗体外扩展
This commit is contained in:
parent
98aadae4d6
commit
fec9f514fc
@ -23,7 +23,8 @@
|
||||
Background="{x:Null}" />
|
||||
<ScrollViewer MaxHeight="400">
|
||||
<TextBox x:Name="TText" Text="我说话长这样,这是我说的话巴拉巴拉巴拉巴拉巴拉巴拉巴拉巴拉巴拉巴拉巴拉巴拉巴拉巴拉" IsReadOnly="True"
|
||||
TextWrapping="WrapWithOverflow" FontSize="24" x:FieldModifier="public" Background="{x:Null}" />
|
||||
TextWrapping="WrapWithOverflow" FontSize="24" x:FieldModifier="public" Background="{x:Null}"
|
||||
BorderBrush="{x:Null}" BorderThickness="0" />
|
||||
</ScrollViewer>
|
||||
<Grid x:Name="MessageBoxContent" x:FieldModifier="public">
|
||||
|
||||
|
@ -72,8 +72,8 @@ namespace VPet_Simulator.Windows
|
||||
{
|
||||
return mw.Dispatcher.Invoke(() =>
|
||||
{
|
||||
if (IsPrimaryScreen) return System.Windows.SystemParameters.PrimaryScreenWidth - mw.Left - mw.Width;
|
||||
return ScreenBorder.Width + ScreenBorder.X - mw.Left - mw.Width;
|
||||
if (IsPrimaryScreen) return System.Windows.SystemParameters.PrimaryScreenWidth - mw.Left - mw.ActualWidth;
|
||||
return ScreenBorder.Width + ScreenBorder.X - mw.Left - mw.ActualWidth;
|
||||
});
|
||||
}
|
||||
|
||||
@ -81,8 +81,8 @@ namespace VPet_Simulator.Windows
|
||||
{
|
||||
return mw.Dispatcher.Invoke(() =>
|
||||
{
|
||||
if (IsPrimaryScreen) return System.Windows.SystemParameters.PrimaryScreenHeight - mw.Top - mw.Height;
|
||||
return ScreenBorder.Height + ScreenBorder.Y - mw.Top - mw.Height;
|
||||
if (IsPrimaryScreen) return System.Windows.SystemParameters.PrimaryScreenHeight - mw.Top - mw.ActualHeight;
|
||||
return ScreenBorder.Height + ScreenBorder.Y - mw.Top - mw.ActualHeight;
|
||||
});
|
||||
}
|
||||
|
||||
@ -111,29 +111,29 @@ namespace VPet_Simulator.Windows
|
||||
{
|
||||
mw.Dispatcher.Invoke(() =>
|
||||
{
|
||||
if (GetWindowsDistanceUp() < -0.25 * mw.Height && GetWindowsDistanceDown() < System.Windows.SystemParameters.PrimaryScreenHeight)
|
||||
if (GetWindowsDistanceUp() < -0.25 * mw.ActualHeight && GetWindowsDistanceDown() < System.Windows.SystemParameters.PrimaryScreenHeight)
|
||||
{
|
||||
MoveWindows(0, -GetWindowsDistanceUp() / ZoomRatio);
|
||||
}
|
||||
else if (GetWindowsDistanceDown() < -0.25 * mw.Height && GetWindowsDistanceUp() < System.Windows.SystemParameters.PrimaryScreenHeight)
|
||||
else if (GetWindowsDistanceDown() < -0.25 * mw.ActualHeight && GetWindowsDistanceUp() < System.Windows.SystemParameters.PrimaryScreenHeight)
|
||||
{
|
||||
MoveWindows(0, GetWindowsDistanceDown() / ZoomRatio);
|
||||
}
|
||||
if (GetWindowsDistanceLeft() < -0.25 * mw.Width && GetWindowsDistanceRight() < System.Windows.SystemParameters.PrimaryScreenWidth)
|
||||
if (GetWindowsDistanceLeft() < -0.25 * mw.ActualWidth && GetWindowsDistanceRight() < System.Windows.SystemParameters.PrimaryScreenWidth)
|
||||
{
|
||||
MoveWindows(-GetWindowsDistanceLeft() / ZoomRatio, 0);
|
||||
}
|
||||
else if (GetWindowsDistanceRight() < -0.25 * mw.Width && GetWindowsDistanceLeft() < System.Windows.SystemParameters.PrimaryScreenWidth)
|
||||
else if (GetWindowsDistanceRight() < -0.25 * mw.ActualWidth && GetWindowsDistanceLeft() < System.Windows.SystemParameters.PrimaryScreenWidth)
|
||||
{
|
||||
MoveWindows(GetWindowsDistanceRight() / ZoomRatio, 0);
|
||||
}
|
||||
});
|
||||
}
|
||||
public bool CheckPosition() => mw.Dispatcher.Invoke(() =>
|
||||
GetWindowsDistanceUp() < -0.25 * mw.Height && GetWindowsDistanceDown() < System.Windows.SystemParameters.PrimaryScreenHeight
|
||||
|| GetWindowsDistanceDown() < -0.25 * mw.Height && GetWindowsDistanceUp() < System.Windows.SystemParameters.PrimaryScreenHeight
|
||||
|| GetWindowsDistanceLeft() < -0.25 * mw.Width && GetWindowsDistanceRight() < System.Windows.SystemParameters.PrimaryScreenWidth
|
||||
|| GetWindowsDistanceRight() < -0.25 * mw.Width && GetWindowsDistanceLeft() < System.Windows.SystemParameters.PrimaryScreenWidth
|
||||
GetWindowsDistanceUp() < -0.25 * mw.ActualHeight && GetWindowsDistanceDown() < System.Windows.SystemParameters.PrimaryScreenHeight
|
||||
|| GetWindowsDistanceDown() < -0.25 * mw.ActualHeight && GetWindowsDistanceUp() < System.Windows.SystemParameters.PrimaryScreenHeight
|
||||
|| GetWindowsDistanceLeft() < -0.25 * mw.ActualWidth && GetWindowsDistanceRight() < System.Windows.SystemParameters.PrimaryScreenWidth
|
||||
|| GetWindowsDistanceRight() < -0.25 * mw.ActualWidth && GetWindowsDistanceLeft() < System.Windows.SystemParameters.PrimaryScreenWidth
|
||||
);
|
||||
|
||||
public bool RePostionActive { get; set; } = true;
|
||||
|
@ -36,6 +36,7 @@ using static VPet_Simulator.Windows.Interface.ExtensionFunction;
|
||||
using Image = System.Windows.Controls.Image;
|
||||
using System.Data;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace VPet_Simulator.Windows
|
||||
{
|
||||
@ -266,7 +267,7 @@ namespace VPet_Simulator.Windows
|
||||
{
|
||||
Set.ZoomLevel = zl;
|
||||
//this.Height = 500 * zl;
|
||||
this.Width = 500 * zl;
|
||||
MGrid.Width = 500 * zl;
|
||||
if (petHelper != null)
|
||||
{
|
||||
petHelper.Width = 50 * zl;
|
||||
@ -1207,8 +1208,8 @@ namespace VPet_Simulator.Windows
|
||||
|
||||
InitializeComponent();
|
||||
|
||||
this.Height = 500 * Set.ZoomLevel;
|
||||
this.Width = 500 * Set.ZoomLevel;
|
||||
//MGrid.Height = 500 * Set.ZoomLevel;
|
||||
MGrid.Width = 500 * Set.ZoomLevel;
|
||||
|
||||
double L = 0, T = 0;
|
||||
if (Set.StartRecordLast)
|
||||
@ -1231,12 +1232,30 @@ namespace VPet_Simulator.Windows
|
||||
|
||||
// control position inside bounds
|
||||
Core.Controller = new MWController(this);
|
||||
double dist;
|
||||
if ((dist = Core.Controller.GetWindowsDistanceLeft()) < 0) Left -= dist;
|
||||
if ((dist = Core.Controller.GetWindowsDistanceRight()) < 0) Left += dist;
|
||||
if ((dist = Core.Controller.GetWindowsDistanceUp()) < 0) Top -= dist;
|
||||
if ((dist = Core.Controller.GetWindowsDistanceDown()) < 0) Top += dist;
|
||||
|
||||
Task.Run(() =>
|
||||
{
|
||||
double dist;
|
||||
if ((dist = Core.Controller.GetWindowsDistanceLeft()) < 0)
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
Dispatcher.Invoke(() => Left -= dist);
|
||||
}
|
||||
if ((dist = Core.Controller.GetWindowsDistanceRight()) < 0)
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
Dispatcher.Invoke(() => Left += dist);
|
||||
}
|
||||
if ((dist = Core.Controller.GetWindowsDistanceUp()) < 0)
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
Dispatcher.Invoke(() => Top -= dist);
|
||||
}
|
||||
if ((dist = Core.Controller.GetWindowsDistanceDown()) < 0)
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
Dispatcher.Invoke(() => Top += dist);
|
||||
}
|
||||
});
|
||||
if (Set.TopMost)
|
||||
{
|
||||
Topmost = true;
|
||||
@ -1735,7 +1754,7 @@ namespace VPet_Simulator.Windows
|
||||
if (Set.MessageBarOutside)
|
||||
Main.MsgBar.SetPlaceOUT();
|
||||
|
||||
Main.ToolBar.WorkCheck = WorkCheck;
|
||||
Main.WorkCheck = WorkCheck;
|
||||
|
||||
//加载图标
|
||||
notifyIcon = new NotifyIcon();
|
||||
@ -1926,8 +1945,8 @@ namespace VPet_Simulator.Windows
|
||||
{
|
||||
if (Main.ToolBar.BdrPanel.Visibility == Visibility.Visible)
|
||||
{
|
||||
tlvplus.Text = $" / {1000 + GameSavesData.GameSave.LevelMax * 100}" +
|
||||
(GameSavesData.GameSave.LevelMax == 0 ? "" : $" x{GameSavesData.GameSave.LevelMax}");
|
||||
if (GameSavesData.GameSave.LevelMax != 0)
|
||||
tlvplus.Text = $" / {1000 + GameSavesData.GameSave.LevelMax * 100} x{GameSavesData.GameSave.LevelMax}";
|
||||
}
|
||||
}
|
||||
#if NewYear
|
||||
|
@ -5,15 +5,17 @@
|
||||
xmlns:pu="clr-namespace:Panuon.WPF.UI;assembly=Panuon.WPF.UI"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" ShowInTaskbar="False"
|
||||
xmlns:local="clr-namespace:VPet_Simulator.Windows" mc:Ignorable="d" WindowStyle="None" Title="MainWindow"
|
||||
Width="250" Closed="Window_Closed" pu:WindowXCaption.Height="0" SizeToContent="Height"
|
||||
Closed="Window_Closed" pu:WindowXCaption.Height="0" SizeToContent="WidthAndHeight"
|
||||
Loaded="Window_SourceInitialized" LocationChanged="WindowX_LocationChanged" Background="{x:Null}">
|
||||
<WindowChrome.WindowChrome>
|
||||
<WindowChrome GlassFrameThickness="-1" />
|
||||
</WindowChrome.WindowChrome>
|
||||
<Grid>
|
||||
<Label x:Name="LoadingText" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Background="{DynamicResource DARKPrimaryLight}" Foreground="{DynamicResource DARKPrimaryText}"
|
||||
Content="Loading" />
|
||||
<Border x:Name="DisplayGrid" />
|
||||
<Grid x:Name="MGrid" Width="250" Height="Auto" >
|
||||
<Label x:Name="LoadingText" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Background="{DynamicResource DARKPrimaryLight}" Foreground="{DynamicResource DARKPrimaryText}"
|
||||
Content="Loading" />
|
||||
<Border x:Name="DisplayGrid" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</pu:WindowX>
|
||||
|
Loading…
x
Reference in New Issue
Block a user