add Screenshot Demo
This commit is contained in:
1 parent
46b1297aa7
commit
4113f9d814
23 files changed
+187
-41
No files matched your search
@@ -480,6 +480,9 @@
|
|||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\cloud.png">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\cloud.png">
|
||||||
<Link>Resources\Img\cloud.png</Link>
|
<Link>Resources\Img\cloud.png</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\WindowScreenshot_16x.png">
|
||||||
|
<Link>Resources\Img\LeftMainContent\WindowScreenshot_16x.png</Link>
|
||||||
|
</Resource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<EmbeddedResource Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\Lang.en.resx">
|
<EmbeddedResource Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\Lang.en.resx">
|
||||||
|
|||||||
@@ -547,6 +547,9 @@
|
|||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\cloud.png">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\cloud.png">
|
||||||
<Link>Resources\Img\cloud.png</Link>
|
<Link>Resources\Img\cloud.png</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\WindowScreenshot_16x.png">
|
||||||
|
<Link>Resources\Img\LeftMainContent\WindowScreenshot_16x.png</Link>
|
||||||
|
</Resource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Data\DemoInfo.json">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Data\DemoInfo.json">
|
||||||
|
|||||||
@@ -610,6 +610,9 @@
|
|||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\cloud.png">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\cloud.png">
|
||||||
<Link>Resources\Img\cloud.png</Link>
|
<Link>Resources\Img\cloud.png</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\WindowScreenshot_16x.png">
|
||||||
|
<Link>Resources\Img\LeftMainContent\WindowScreenshot_16x.png</Link>
|
||||||
|
</Resource>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\fabric-icons.ttf">
|
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\fabric-icons.ttf">
|
||||||
|
|||||||
@@ -317,6 +317,9 @@
|
|||||||
<Resource Include="..\HandyControlDemo_Shared\UserControl\Controls\RunningBlockDemoCtl.xaml">
|
<Resource Include="..\HandyControlDemo_Shared\UserControl\Controls\RunningBlockDemoCtl.xaml">
|
||||||
<Link>UserControl\Controls\RunningBlockDemoCtl.xaml</Link>
|
<Link>UserControl\Controls\RunningBlockDemoCtl.xaml</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\HandyControlDemo_Shared\UserControl\Controls\ScreenshotDemoCtl.xaml">
|
||||||
|
<Link>UserControl\Controls\ScreenshotDemoCtl.xaml</Link>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\HandyControlDemo_Shared\UserControl\Controls\ScrollViewerDemoCtl.xaml">
|
<Resource Include="..\HandyControlDemo_Shared\UserControl\Controls\ScrollViewerDemoCtl.xaml">
|
||||||
<Link>UserControl\Controls\ScrollViewerDemoCtl.xaml</Link>
|
<Link>UserControl\Controls\ScrollViewerDemoCtl.xaml</Link>
|
||||||
</Resource>
|
</Resource>
|
||||||
@@ -713,6 +716,10 @@
|
|||||||
<Link>UserControl\Controls\RunningBlockDemoCtl.xaml.cs</Link>
|
<Link>UserControl\Controls\RunningBlockDemoCtl.xaml.cs</Link>
|
||||||
<DependentUpon>RunningBlockDemoCtl.xaml</DependentUpon>
|
<DependentUpon>RunningBlockDemoCtl.xaml</DependentUpon>
|
||||||
</Resource>
|
</Resource>
|
||||||
|
<Resource Include="..\HandyControlDemo_Shared\UserControl\Controls\ScreenshotDemoCtl.xaml.cs">
|
||||||
|
<Link>UserControl\Controls\ScreenshotDemoCtl.xaml.cs</Link>
|
||||||
|
<DependentUpon>ScreenshotDemoCtl.xaml</DependentUpon>
|
||||||
|
</Resource>
|
||||||
<Resource Include="..\HandyControlDemo_Shared\UserControl\Controls\ScrollViewerDemoCtl.xaml.cs">
|
<Resource Include="..\HandyControlDemo_Shared\UserControl\Controls\ScrollViewerDemoCtl.xaml.cs">
|
||||||
<Link>UserControl\Controls\ScrollViewerDemoCtl.xaml.cs</Link>
|
<Link>UserControl\Controls\ScrollViewerDemoCtl.xaml.cs</Link>
|
||||||
<DependentUpon>ScrollViewerDemoCtl.xaml</DependentUpon>
|
<DependentUpon>ScrollViewerDemoCtl.xaml</DependentUpon>
|
||||||
|
|||||||
@@ -98,6 +98,7 @@
|
|||||||
[ "Sprite", "SpriteDemoCtl", "HandyControl", "" ],
|
[ "Sprite", "SpriteDemoCtl", "HandyControl", "" ],
|
||||||
[ "Notification", "NotificationDemoCtl", "Procedure_16x", "" ],
|
[ "Notification", "NotificationDemoCtl", "Procedure_16x", "" ],
|
||||||
[ "Dialog", "DialogDemoCtl", "Dialog_16x", "" ],
|
[ "Dialog", "DialogDemoCtl", "Dialog_16x", "" ],
|
||||||
|
[ "Screenshot", "ScreenshotDemoCtl", "WindowScreenshot_16x", "1" ],
|
||||||
[ "Window", "WindowDemoCtl", "WindowsForm_16x", "1" ]
|
[ "Window", "WindowDemoCtl", "WindowsForm_16x", "1" ]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -106,7 +107,7 @@
|
|||||||
"demoItemList": [
|
"demoItemList": [
|
||||||
[ "HatchBrushGenerator", "HatchBrushGeneratorDemoCtl", "DataGenerator_16x", "" ],
|
[ "HatchBrushGenerator", "HatchBrushGeneratorDemoCtl", "DataGenerator_16x", "" ],
|
||||||
[ "Morphing Animation", "GeometryAnimationDemoCtl", "Animation_16x", "" ],
|
[ "Morphing Animation", "GeometryAnimationDemoCtl", "Animation_16x", "" ],
|
||||||
[ "Effects", "EffectsDemoCtl", "Effects_16x", "1" ]
|
[ "Effects", "EffectsDemoCtl", "Effects_16x", "" ]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
@@ -190,6 +190,9 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\RunningBlockDemoCtl.xaml.cs">
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\RunningBlockDemoCtl.xaml.cs">
|
||||||
<DependentUpon>RunningBlockDemoCtl.xaml</DependentUpon>
|
<DependentUpon>RunningBlockDemoCtl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\ScreenshotDemoCtl.xaml.cs">
|
||||||
|
<DependentUpon>ScreenshotDemoCtl.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\ScrollViewerDemoCtl.xaml.cs">
|
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\ScrollViewerDemoCtl.xaml.cs">
|
||||||
<DependentUpon>ScrollViewerDemoCtl.xaml</DependentUpon>
|
<DependentUpon>ScrollViewerDemoCtl.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
@@ -684,6 +687,10 @@
|
|||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\ScreenshotDemoCtl.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\ScrollViewerDemoCtl.xaml">
|
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\ScrollViewerDemoCtl.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|||||||
@@ -1176,15 +1176,6 @@ namespace HandyControlDemo.Properties.Langs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查找类似 概览 的本地化字符串。
|
|
||||||
/// </summary>
|
|
||||||
public static string Overview {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("Overview", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 页码条 的本地化字符串。
|
/// 查找类似 页码条 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1491,6 +1482,15 @@ namespace HandyControlDemo.Properties.Langs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 截图 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string Screenshot {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("Screenshot", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 滚动视图 的本地化字符串。
|
/// 查找类似 滚动视图 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1608,6 +1608,15 @@ namespace HandyControlDemo.Properties.Langs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 开始截图 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string StartScreenshot {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("StartScreenshot", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 保持打开 的本地化字符串。
|
/// 查找类似 保持打开 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -738,4 +738,10 @@
|
|||||||
<data name="PracticalDemos" xml:space="preserve">
|
<data name="PracticalDemos" xml:space="preserve">
|
||||||
<value>Practical demos</value>
|
<value>Practical demos</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="StartScreenshot" xml:space="preserve">
|
||||||
|
<value>Start screenshot</value>
|
||||||
|
</data>
|
||||||
|
<data name="Screenshot" xml:space="preserve">
|
||||||
|
<value>Screenshot</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -738,4 +738,10 @@
|
|||||||
<data name="PracticalDemos" xml:space="preserve">
|
<data name="PracticalDemos" xml:space="preserve">
|
||||||
<value>Practical demos</value>
|
<value>Practical demos</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="StartScreenshot" xml:space="preserve">
|
||||||
|
<value>Start screenshot</value>
|
||||||
|
</data>
|
||||||
|
<data name="Screenshot" xml:space="preserve">
|
||||||
|
<value>Screenshot</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -738,4 +738,10 @@
|
|||||||
<data name="PracticalDemos" xml:space="preserve">
|
<data name="PracticalDemos" xml:space="preserve">
|
||||||
<value>Practical demos</value>
|
<value>Practical demos</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="StartScreenshot" xml:space="preserve">
|
||||||
|
<value>Start screenshot</value>
|
||||||
|
</data>
|
||||||
|
<data name="Screenshot" xml:space="preserve">
|
||||||
|
<value>Screenshot</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -738,4 +738,10 @@
|
|||||||
<data name="PracticalDemos" xml:space="preserve">
|
<data name="PracticalDemos" xml:space="preserve">
|
||||||
<value>Practical demos</value>
|
<value>Practical demos</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="StartScreenshot" xml:space="preserve">
|
||||||
|
<value>Start screenshot</value>
|
||||||
|
</data>
|
||||||
|
<data name="Screenshot" xml:space="preserve">
|
||||||
|
<value>Screenshot</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -738,4 +738,10 @@
|
|||||||
<data name="PracticalDemos" xml:space="preserve">
|
<data name="PracticalDemos" xml:space="preserve">
|
||||||
<value>实用例子</value>
|
<value>实用例子</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="StartScreenshot" xml:space="preserve">
|
||||||
|
<value>开始截图</value>
|
||||||
|
</data>
|
||||||
|
<data name="Screenshot" xml:space="preserve">
|
||||||
|
<value>截图</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 207 B |
@@ -0,0 +1,10 @@
|
|||||||
|
<UserControl x:Class="HandyControlDemo.UserControl.ScreenshotDemoCtl"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
|
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||||
|
Background="{DynamicResource RegionBrush}">
|
||||||
|
<hc:TransitioningContentControl>
|
||||||
|
<Button Content="{x:Static langs:Lang.StartScreenshot}" Command="hc:ControlCommands.StartScreenshot"/>
|
||||||
|
</hc:TransitioningContentControl>
|
||||||
|
</UserControl>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using HandyControl.Controls;
|
||||||
|
using HandyControl.Data;
|
||||||
|
|
||||||
|
namespace HandyControlDemo.UserControl
|
||||||
|
{
|
||||||
|
public partial class ScreenshotDemoCtl : IDisposable
|
||||||
|
{
|
||||||
|
public ScreenshotDemoCtl()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
Screenshot.Snapped += Screenshot_Snapped;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Screenshot_Snapped(object sender, FunctionEventArgs<ImageSource> e)
|
||||||
|
{
|
||||||
|
new HandyControl.Controls.Window
|
||||||
|
{
|
||||||
|
Content = new Image
|
||||||
|
{
|
||||||
|
Source = e.Info,
|
||||||
|
Stretch = Stretch.None
|
||||||
|
},
|
||||||
|
WindowStartupLocation = WindowStartupLocation.CenterScreen
|
||||||
|
}.ShowDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Dispose() => Screenshot.Snapped -= Screenshot_Snapped;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||||
xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit"
|
xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit"
|
||||||
x:Class="HandyControlDemo.UserControl.MainContent">
|
x:Class="HandyControlDemo.UserControl.MainContent">
|
||||||
<Grid Name="GridMain" MinHeight="300" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="16">
|
<Grid Name="GridMain" MinHeight="300" MinWidth="200" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="16">
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition/>
|
<RowDefinition/>
|
||||||
|
|||||||
@@ -1,16 +1,15 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using HandyControl.Data;
|
||||||
|
|
||||||
namespace HandyControl.Controls
|
namespace HandyControl.Controls
|
||||||
{
|
{
|
||||||
public class Screenshot
|
public class Screenshot
|
||||||
{
|
{
|
||||||
public event EventHandler Snapped;
|
public static event EventHandler<FunctionEventArgs<ImageSource>> Snapped;
|
||||||
|
|
||||||
public ImageSource Source { get; set; }
|
|
||||||
|
|
||||||
public void Start() => new ScreenshotWindow(this).Show();
|
public void Start() => new ScreenshotWindow(this).Show();
|
||||||
|
|
||||||
internal void OnSnapped() => Snapped?.Invoke(this, EventArgs.Empty);
|
internal void OnSnapped(ImageSource source) => Snapped?.Invoke(this, new FunctionEventArgs<ImageSource>(source));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,8 +26,6 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
#region const
|
#region const
|
||||||
|
|
||||||
private const int RectMinLength = 14;
|
|
||||||
|
|
||||||
private const int IntervalLength = 1;
|
private const int IntervalLength = 1;
|
||||||
|
|
||||||
private const int IntervalBigLength = 10;
|
private const int IntervalBigLength = 10;
|
||||||
@@ -60,6 +58,8 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private Point _mousePointOld;
|
private Point _mousePointOld;
|
||||||
|
|
||||||
|
private bool _saveScreenshot;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -177,7 +177,8 @@ namespace HandyControl.Controls
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Key.Enter:
|
case Key.Enter:
|
||||||
SaveScreenshot();
|
_saveScreenshot = true;
|
||||||
|
Close();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -185,7 +186,11 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e) => _mousePointOld = e.GetPosition(this);
|
protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e) => _mousePointOld = e.GetPosition(this);
|
||||||
|
|
||||||
protected override void OnPreviewMouseDoubleClick(MouseButtonEventArgs e) => SaveScreenshot();
|
protected override void OnPreviewMouseDoubleClick(MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
_saveScreenshot = true;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
|
||||||
protected override void OnPreviewMouseMove(MouseEventArgs e)
|
protected override void OnPreviewMouseMove(MouseEventArgs e)
|
||||||
{
|
{
|
||||||
@@ -282,6 +287,11 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
private void ScreenshotWindow_Closed(object sender, EventArgs e)
|
private void ScreenshotWindow_Closed(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (_saveScreenshot)
|
||||||
|
{
|
||||||
|
SaveScreenshot();
|
||||||
|
}
|
||||||
|
|
||||||
StopHooks();
|
StopHooks();
|
||||||
IsDrawing = false;
|
IsDrawing = false;
|
||||||
|
|
||||||
@@ -442,10 +452,9 @@ namespace HandyControl.Controls
|
|||||||
if (Canvas.Background is ImageBrush imageBrush && imageBrush.ImageSource is BitmapSource bitmapSource)
|
if (Canvas.Background is ImageBrush imageBrush && imageBrush.ImageSource is BitmapSource bitmapSource)
|
||||||
{
|
{
|
||||||
var cb = new CroppedBitmap(bitmapSource, new Int32Rect(_targetWindowRect.Left, _targetWindowRect.Top, _targetWindowRect.Width, _targetWindowRect.Height));
|
var cb = new CroppedBitmap(bitmapSource, new Int32Rect(_targetWindowRect.Left, _targetWindowRect.Top, _targetWindowRect.Width, _targetWindowRect.Height));
|
||||||
_screenshot.Source = cb;
|
_screenshot.OnSnapped(cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
_screenshot.OnSnapped();
|
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -488,7 +497,21 @@ namespace HandyControl.Controls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RegularRect(ref InteropValues.RECT rect)
|
private static InteropValues.RECT MoveRect(InteropValues.RECT rect, int leftFlag = 0, int topFlag = 0, int rightFlag = 0, int bottomFlag = 0)
|
||||||
|
{
|
||||||
|
var moveLength = Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)
|
||||||
|
? IntervalBigLength
|
||||||
|
: IntervalLength;
|
||||||
|
|
||||||
|
rect.Left += leftFlag * moveLength;
|
||||||
|
rect.Top += topFlag * moveLength;
|
||||||
|
rect.Right += rightFlag * moveLength;
|
||||||
|
rect.Bottom += bottomFlag * moveLength;
|
||||||
|
|
||||||
|
return rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void MoveTargetArea(InteropValues.RECT rect)
|
||||||
{
|
{
|
||||||
if (rect.Left < 0)
|
if (rect.Left < 0)
|
||||||
{
|
{
|
||||||
@@ -516,25 +539,6 @@ namespace HandyControl.Controls
|
|||||||
|
|
||||||
rect.Left = Math.Max(0, rect.Left);
|
rect.Left = Math.Max(0, rect.Left);
|
||||||
rect.Top = Math.Max(0, rect.Top);
|
rect.Top = Math.Max(0, rect.Top);
|
||||||
}
|
|
||||||
|
|
||||||
private static InteropValues.RECT MoveRect(InteropValues.RECT rect, int leftFlag = 0, int topFlag = 0, int rightFlag = 0, int bottomFlag = 0)
|
|
||||||
{
|
|
||||||
var moveLength = Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl)
|
|
||||||
? IntervalBigLength
|
|
||||||
: IntervalLength;
|
|
||||||
|
|
||||||
rect.Left += leftFlag * moveLength;
|
|
||||||
rect.Top += topFlag * moveLength;
|
|
||||||
rect.Right += rightFlag * moveLength;
|
|
||||||
rect.Bottom += bottomFlag * moveLength;
|
|
||||||
|
|
||||||
return rect;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void MoveTargetArea(InteropValues.RECT rect)
|
|
||||||
{
|
|
||||||
RegularRect(ref rect);
|
|
||||||
|
|
||||||
var width = rect.Width;
|
var width = rect.Width;
|
||||||
var height = rect.Height;
|
var height = rect.Height;
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)Data\HwndWrapper.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Data\HwndWrapper.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\CloseWindowCommand.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\CloseWindowCommand.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\OpenLinkCommand.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\OpenLinkCommand.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\StartScreenshotCommand.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\DiscreteGeometryKeyFrame.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\DiscreteGeometryKeyFrame.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\EasingGeometryKeyFrame.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\EasingGeometryKeyFrame.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\GeometryAnimation.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\GeometryAnimation.cs" />
|
||||||
|
|||||||
@@ -161,5 +161,10 @@ namespace HandyControl.Interactivity
|
|||||||
/// 关闭窗口
|
/// 关闭窗口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static CloseWindowCommand CloseWindow { get; } = new CloseWindowCommand();
|
public static CloseWindowCommand CloseWindow { get; } = new CloseWindowCommand();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 开始截图
|
||||||
|
/// </summary>
|
||||||
|
public static StartScreenshotCommand StartScreenshot { get; } = new StartScreenshotCommand();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using HandyControl.Controls;
|
||||||
|
|
||||||
|
namespace HandyControl.Interactivity
|
||||||
|
{
|
||||||
|
public class StartScreenshotCommand : ICommand
|
||||||
|
{
|
||||||
|
public bool CanExecute(object parameter) => true;
|
||||||
|
|
||||||
|
public void Execute(object parameter) => new Screenshot().Start();
|
||||||
|
|
||||||
|
public event EventHandler CanExecuteChanged;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
using System;
|
||||||
|
using System.Windows.Input;
|
||||||
|
using HandyControl.Controls;
|
||||||
|
|
||||||
|
namespace HandyControl.Interactivity
|
||||||
|
{
|
||||||
|
public class StartScreenshotCommand : ICommand
|
||||||
|
{
|
||||||
|
public bool CanExecute(object parameter) => true;
|
||||||
|
|
||||||
|
public void Execute(object parameter) => new Screenshot().Start();
|
||||||
|
|
||||||
|
public event EventHandler CanExecuteChanged;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ using System.Runtime.InteropServices;
|
|||||||
using System.Security;
|
using System.Security;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
|
using HandyControl.Tools.Extension;
|
||||||
using HandyControl.Tools.Interop;
|
using HandyControl.Tools.Interop;
|
||||||
|
|
||||||
namespace HandyControl.Tools
|
namespace HandyControl.Tools
|
||||||
|
|||||||
Reference in new issue
Block a user