Merge branch 'gghc' into gg
This commit is contained in:
commit
af26af2259
56 files changed
+1483
-255
No files matched your search
@@ -27,32 +27,33 @@
|
||||
|
||||
## Contributors
|
||||
|
||||
<a href="https://github.com/ghost1372" target="_blank"><img width="64px" src="https://avatars0.githubusercontent.com/u/9213496?s=400&v=4"></a>
|
||||
<a href="https://github.com/DingpingZhang" target="_blank"><img width="64px" src="https://avatars0.githubusercontent.com/u/8541016?s=400&v=4"></a>
|
||||
<a href="https://github.com/M0n7y5" target="_blank"><img width="64px" src="https://avatars0.githubusercontent.com/u/17201053?s=400&v=4"></a>
|
||||
<a href="https://github.com/guanguanchuangyu" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/25916858?s=400&v=4"></a>
|
||||
<a href="https://github.com/yanchao891012" target="_blank"><img width="64px" src="https://avatars0.githubusercontent.com/u/16846702?s=400&v=4"></a>
|
||||
<a href="https://github.com/noctwolf" target="_blank"><img width="64px" src="https://avatars3.githubusercontent.com/u/21022467?s=400&v=4"></a>
|
||||
<a href="https://github.com/xianyun666" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/22339210?s=400&v=4"></a>
|
||||
<a href="https://github.com/afunc233" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/19919631?s=400&v=4"></a>
|
||||
<a href="https://github.com/DinoChan" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/6076257?s=400&v=4"></a>
|
||||
<a href="https://github.com/MrZhangYuan" target="_blank"><img width="64px" src="https://avatars2.githubusercontent.com/u/16384123?s=400&v=4"></a>
|
||||
<a href="https://github.com/ghost1372" target="_blank"><img width="64px" src="https://avatars0.githubusercontent.com/u/9213496?s=64&v=4"></a>
|
||||
<a href="https://github.com/DingpingZhang" target="_blank"><img width="64px" src="https://avatars0.githubusercontent.com/u/8541016?s=64&v=4"></a>
|
||||
<a href="https://github.com/M0n7y5" target="_blank"><img width="64px" src="https://avatars0.githubusercontent.com/u/17201053?s=64&v=4"></a>
|
||||
<a href="https://github.com/guanguanchuangyu" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/25916858?s=64&v=4"></a>
|
||||
<a href="https://github.com/yanchao891012" target="_blank"><img width="64px" src="https://avatars0.githubusercontent.com/u/16846702?s=64&v=4"></a>
|
||||
<a href="https://github.com/noctwolf" target="_blank"><img width="64px" src="https://avatars3.githubusercontent.com/u/21022467?s=64&v=4"></a>
|
||||
<a href="https://github.com/xianyun666" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/22339210?s=64&v=4"></a>
|
||||
<a href="https://github.com/afunc233" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/19919631?s=64&v=4"></a>
|
||||
<a href="https://github.com/DinoChan" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/6076257?s=64&v=4"></a>
|
||||
<a href="https://github.com/MrZhangYuan" target="_blank"><img width="64px" src="https://avatars2.githubusercontent.com/u/16384123?s=64&v=4"></a>
|
||||
|
||||
## Backers
|
||||
|
||||
<a href="https://github.com/bigorange1900" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/49062011?s=400&v=4"></a>
|
||||
<a href="https://github.com/14632791" target="_blank"><img width="64px" src="https://avatars3.githubusercontent.com/u/27358331?s=400&v=4"></a>
|
||||
<a href="https://github.com/IUpdatable" target="_blank"><img width="64px" src="https://avatars2.githubusercontent.com/u/51181716?s=400&v=4"></a>
|
||||
<a href="https://github.com/maplewei" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/13778095?s=400&v=4"></a>
|
||||
<a href="https://github.com/sunshang-hl" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/34593206?s=400&v=4"></a>
|
||||
<a href="https://github.com/yangkang326" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/51224259?s=400&v=4"></a>
|
||||
<a href="https://github.com/zmrbak" target="_blank"><img width="64px" src="https://avatars3.githubusercontent.com/u/7257543?s=400&v=4"></a>
|
||||
<a href="https://github.com/AFei19911012" target="_blank"><img width="64px" src="https://avatars0.githubusercontent.com/u/31465314?s=400&v=4"></a>
|
||||
<a href="https://github.com/wayne2006" target="_blank"><img width="64px" src="https://avatars0.githubusercontent.com/u/21210915?s=400&v=4"></a>
|
||||
<a href="https://github.com/towerDLH" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/53053537?s=400&v=4"></a>
|
||||
<a href="https://github.com/BluceBosen" target="_blank"><img width="64px" src="https://avatars3.githubusercontent.com/u/24750822?s=400&v=4"></a>
|
||||
<a href="https://github.com/MrZhangYuan" target="_blank"><img width="64px" src="https://avatars2.githubusercontent.com/u/16384123?s=400&v=4"></a>
|
||||
<a href="https://github.com/YC946586" target="_blank"><img width="64px" src="https://avatars2.githubusercontent.com/u/49895722?s=400&v=4"></a>
|
||||
<a href="https://github.com/bigorange1900" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/49062011?s=64&v=4"></a>
|
||||
<a href="https://github.com/14632791" target="_blank"><img width="64px" src="https://avatars3.githubusercontent.com/u/27358331?s=64&v=4"></a>
|
||||
<a href="https://github.com/IUpdatable" target="_blank"><img width="64px" src="https://avatars2.githubusercontent.com/u/51181716?s=64&v=4"></a>
|
||||
<a href="https://github.com/maplewei" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/13778095?s=64&v=4"></a>
|
||||
<a href="https://github.com/sunshang-hl" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/34593206?s=64&v=4"></a>
|
||||
<a href="https://github.com/yangkang326" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/51224259?s=64&v=4"></a>
|
||||
<a href="https://github.com/zmrbak" target="_blank"><img width="64px" src="https://avatars3.githubusercontent.com/u/7257543?s=64&v=4"></a>
|
||||
<a href="https://github.com/AFei19911012" target="_blank"><img width="64px" src="https://avatars0.githubusercontent.com/u/31465314?s=64&v=4"></a>
|
||||
<a href="https://github.com/wayne2006" target="_blank"><img width="64px" src="https://avatars0.githubusercontent.com/u/21210915?s=64&v=4"></a>
|
||||
<a href="https://github.com/towerDLH" target="_blank"><img width="64px" src="https://avatars1.githubusercontent.com/u/53053537?s=64&v=4"></a>
|
||||
<a href="https://github.com/BluceBosen" target="_blank"><img width="64px" src="https://avatars3.githubusercontent.com/u/24750822?s=64&v=4"></a>
|
||||
<a href="https://github.com/MrZhangYuan" target="_blank"><img width="64px" src="https://avatars2.githubusercontent.com/u/16384123?s=64&v=4"></a>
|
||||
<a href="https://github.com/YC946586" target="_blank"><img width="64px" src="https://avatars2.githubusercontent.com/u/49895722?s=64&v=4"></a>
|
||||
<a href="https://github.com/wihalo" target="_blank"><img width="64px" src="https://avatars0.githubusercontent.com/u/26402999?s=64&v=4"></a>
|
||||
|
||||
## Special thanks to
|
||||
|
||||
@@ -98,6 +99,10 @@ Step 4:enjoy coding
|
||||
|
||||
## Latest examples
|
||||
|
||||
### Screenshot
|
||||
|
||||

|
||||
|
||||
### GooeyEffect
|
||||
|
||||

|
||||
@@ -114,6 +119,8 @@ Step 4:enjoy coding
|
||||
|
||||

|
||||
|
||||
## History publication
|
||||
|
||||
### Effects
|
||||
|
||||

|
||||
@@ -122,8 +129,6 @@ Step 4:enjoy coding
|
||||
|
||||

|
||||
|
||||
## History publication
|
||||
|
||||
### Drawer
|
||||
|
||||

|
||||
|
||||
@@ -480,6 +480,9 @@
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\cloud.png">
|
||||
<Link>Resources\Img\cloud.png</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\WindowScreenshot_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\WindowScreenshot_16x.png</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="..\..\Shared\HandyControlDemo_Shared\Properties\Langs\Lang.en.resx">
|
||||
|
||||
@@ -547,6 +547,9 @@
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\cloud.png">
|
||||
<Link>Resources\Img\cloud.png</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\WindowScreenshot_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\WindowScreenshot_16x.png</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Data\DemoInfo.json">
|
||||
|
||||
@@ -610,6 +610,9 @@
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\cloud.png">
|
||||
<Link>Resources\Img\cloud.png</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\Img\LeftMainContent\WindowScreenshot_16x.png">
|
||||
<Link>Resources\Img\LeftMainContent\WindowScreenshot_16x.png</Link>
|
||||
</Resource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="..\..\Shared\HandyControlDemo_Shared\Resources\fabric-icons.ttf">
|
||||
|
||||
@@ -317,6 +317,9 @@
|
||||
<Resource Include="..\HandyControlDemo_Shared\UserControl\Controls\RunningBlockDemoCtl.xaml">
|
||||
<Link>UserControl\Controls\RunningBlockDemoCtl.xaml</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\HandyControlDemo_Shared\UserControl\Controls\ScreenshotDemoCtl.xaml">
|
||||
<Link>UserControl\Controls\ScreenshotDemoCtl.xaml</Link>
|
||||
</Resource>
|
||||
<Resource Include="..\HandyControlDemo_Shared\UserControl\Controls\ScrollViewerDemoCtl.xaml">
|
||||
<Link>UserControl\Controls\ScrollViewerDemoCtl.xaml</Link>
|
||||
</Resource>
|
||||
@@ -713,6 +716,10 @@
|
||||
<Link>UserControl\Controls\RunningBlockDemoCtl.xaml.cs</Link>
|
||||
<DependentUpon>RunningBlockDemoCtl.xaml</DependentUpon>
|
||||
</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">
|
||||
<Link>UserControl\Controls\ScrollViewerDemoCtl.xaml.cs</Link>
|
||||
<DependentUpon>ScrollViewerDemoCtl.xaml</DependentUpon>
|
||||
|
||||
@@ -7,7 +7,6 @@ using System.Runtime;
|
||||
using System.Security.Authentication;
|
||||
using System.Threading;
|
||||
using System.Windows;
|
||||
using System.Windows.Media.Animation;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools;
|
||||
using HandyControlDemo.Data;
|
||||
|
||||
@@ -98,6 +98,7 @@
|
||||
[ "Sprite", "SpriteDemoCtl", "HandyControl", "" ],
|
||||
[ "Notification", "NotificationDemoCtl", "Procedure_16x", "" ],
|
||||
[ "Dialog", "DialogDemoCtl", "Dialog_16x", "" ],
|
||||
[ "Screenshot", "ScreenshotDemoCtl", "WindowScreenshot_16x", "1" ],
|
||||
[ "Window", "WindowDemoCtl", "WindowsForm_16x", "1" ]
|
||||
]
|
||||
},
|
||||
@@ -106,7 +107,7 @@
|
||||
"demoItemList": [
|
||||
[ "HatchBrushGenerator", "HatchBrushGeneratorDemoCtl", "DataGenerator_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">
|
||||
<DependentUpon>RunningBlockDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\ScreenshotDemoCtl.xaml.cs">
|
||||
<DependentUpon>ScreenshotDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Controls\ScrollViewerDemoCtl.xaml.cs">
|
||||
<DependentUpon>ScrollViewerDemoCtl.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -684,6 +687,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\ScreenshotDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Controls\ScrollViewerDemoCtl.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<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>
|
||||
@@ -1491,6 +1482,15 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 截图 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string Screenshot {
|
||||
get {
|
||||
return ResourceManager.GetString("Screenshot", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 滚动视图 的本地化字符串。
|
||||
/// </summary>
|
||||
@@ -1608,6 +1608,15 @@ namespace HandyControlDemo.Properties.Langs {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 开始截图 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string StartScreenshot {
|
||||
get {
|
||||
return ResourceManager.GetString("StartScreenshot", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 保持打开 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -738,4 +738,10 @@
|
||||
<data name="PracticalDemos" xml:space="preserve">
|
||||
<value>Practical demos</value>
|
||||
</data>
|
||||
<data name="StartScreenshot" xml:space="preserve">
|
||||
<value>Start screenshot</value>
|
||||
</data>
|
||||
<data name="Screenshot" xml:space="preserve">
|
||||
<value>Screenshot</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -738,4 +738,10 @@
|
||||
<data name="PracticalDemos" xml:space="preserve">
|
||||
<value>Practical demos</value>
|
||||
</data>
|
||||
<data name="StartScreenshot" xml:space="preserve">
|
||||
<value>Start screenshot</value>
|
||||
</data>
|
||||
<data name="Screenshot" xml:space="preserve">
|
||||
<value>Screenshot</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -738,4 +738,10 @@
|
||||
<data name="PracticalDemos" xml:space="preserve">
|
||||
<value>Practical demos</value>
|
||||
</data>
|
||||
<data name="StartScreenshot" xml:space="preserve">
|
||||
<value>Start screenshot</value>
|
||||
</data>
|
||||
<data name="Screenshot" xml:space="preserve">
|
||||
<value>Screenshot</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -738,4 +738,10 @@
|
||||
<data name="PracticalDemos" xml:space="preserve">
|
||||
<value>Practical demos</value>
|
||||
</data>
|
||||
<data name="StartScreenshot" xml:space="preserve">
|
||||
<value>Start screenshot</value>
|
||||
</data>
|
||||
<data name="Screenshot" xml:space="preserve">
|
||||
<value>Screenshot</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -738,4 +738,10 @@
|
||||
<data name="PracticalDemos" xml:space="preserve">
|
||||
<value>实用例子</value>
|
||||
</data>
|
||||
<data name="StartScreenshot" xml:space="preserve">
|
||||
<value>开始截图</value>
|
||||
</data>
|
||||
<data name="Screenshot" xml:space="preserve">
|
||||
<value>截图</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 207 B |
@@ -3,8 +3,6 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:command="http://www.galasoft.ch/mvvmlight"
|
||||
xmlns:data="clr-namespace:HandyControlDemo.Data"
|
||||
DataContext="{Binding NotifyIconDemo,Source={StaticResource Locator}}"
|
||||
Background="{DynamicResource RegionBrush}">
|
||||
@@ -47,14 +45,14 @@
|
||||
<MenuItem Command="hc:ControlCommands.ShutdownApp" Header="{x:Static langs:Lang.Exit}"/>
|
||||
</ContextMenu>
|
||||
</hc:NotifyIcon.ContextMenu>
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<command:EventToCommand Command="hc:ControlCommands.PushMainWindow2Top"/>
|
||||
</i:EventTrigger>
|
||||
<i:EventTrigger EventName="MouseDoubleClick">
|
||||
<command:EventToCommand Command="{Binding MouseCmd}" CommandParameter="MouseDoubleClick"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<hc:Interaction.Triggers>
|
||||
<hc:EventTrigger EventName="Click">
|
||||
<hc:EventToCommand Command="hc:ControlCommands.PushMainWindow2Top"/>
|
||||
</hc:EventTrigger>
|
||||
<hc:EventTrigger EventName="MouseDoubleClick">
|
||||
<hc:EventToCommand Command="{Binding MouseCmd}" CommandParameter="MouseDoubleClick"/>
|
||||
</hc:EventTrigger>
|
||||
</hc:Interaction.Triggers>
|
||||
</hc:NotifyIcon>
|
||||
<hc:NotifyIcon Token="{x:Static data:MessageToken.NotifyIconContextDemo}" x:Name="NotifyIconContextContent" Text="HandyControl" IsBlink="{Binding ContextContentIsBlink}" Visibility="{Binding ContextContentIsShow,Converter={StaticResource Boolean2VisibilityConverter}}" Icon="/HandyControlDemo;component/Resources/Img/icon-white.ico">
|
||||
<hc:NotifyIcon.ContextContent>
|
||||
@@ -68,14 +66,14 @@
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</hc:NotifyIcon.ContextContent>
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="Click">
|
||||
<command:EventToCommand Command="hc:ControlCommands.PushMainWindow2Top"/>
|
||||
</i:EventTrigger>
|
||||
<i:EventTrigger EventName="MouseDoubleClick">
|
||||
<command:EventToCommand Command="{Binding MouseCmd}" CommandParameter="MouseDoubleClick"/>
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<hc:Interaction.Triggers>
|
||||
<hc:EventTrigger EventName="Click">
|
||||
<hc:EventToCommand Command="hc:ControlCommands.PushMainWindow2Top"/>
|
||||
</hc:EventTrigger>
|
||||
<hc:EventTrigger EventName="MouseDoubleClick">
|
||||
<hc:EventToCommand Command="{Binding MouseCmd}" CommandParameter="MouseDoubleClick"/>
|
||||
</hc:EventTrigger>
|
||||
</hc:Interaction.Triggers>
|
||||
</hc:NotifyIcon>
|
||||
</hc:SimplePanel>
|
||||
</hc:TransitioningContentControl>
|
||||
|
||||
@@ -36,12 +36,12 @@
|
||||
<UniformGrid Grid.Column="1" Columns="3">
|
||||
<Button Margin="8,0" Tag="0" Style="{StaticResource Button4PoptipStyle}">
|
||||
<hc:Poptip.Instance>
|
||||
<hc:Poptip Content="{x:Static langs:Lang.Text}" Placement="TopLeft"/>
|
||||
<hc:Poptip Content="{x:Static langs:Lang.Text}" PlacementType="TopLeft"/>
|
||||
</hc:Poptip.Instance>
|
||||
</Button>
|
||||
<Button Margin="8,0" Tag="1" Style="{StaticResource Button4PoptipStyle}">
|
||||
<hc:Poptip.Instance>
|
||||
<hc:Poptip Placement="Top">
|
||||
<hc:Poptip PlacementType="Top">
|
||||
<hc:Poptip.Content>
|
||||
<Path Width="100" Height="100" Fill="#f06632" Data="{StaticResource LogoGeometry}"/>
|
||||
</hc:Poptip.Content>
|
||||
@@ -54,7 +54,7 @@
|
||||
<ToggleButton hc:Poptip.HitMode="None" hc:Poptip.IsOpen="{Binding IsChecked,RelativeSource={RelativeSource Self}}" hc:Poptip.Content="{x:Static langs:Lang.Text}" hc:Poptip.Placement="RightTop" Margin="8,16" Tag="3" Style="{StaticResource ToggleButton4PoptipStyle}"/>
|
||||
<ToggleButton Margin="8,16" Tag="4" Style="{StaticResource ToggleButton4PoptipStyle}">
|
||||
<hc:Poptip.Instance>
|
||||
<hc:Poptip Background="Transparent" Padding="0" BorderThickness="0" HitMode="None" Placement="Right" IsOpen="{Binding Target.IsChecked,RelativeSource={RelativeSource Self}}">
|
||||
<hc:Poptip Background="Transparent" Padding="0" BorderThickness="0" HitMode="None" PlacementType="Right" IsOpen="{Binding Target.IsChecked,RelativeSource={RelativeSource Self}}">
|
||||
<hc:Poptip.Content>
|
||||
<Path Width="100" Height="100" Fill="#f06632" Data="{StaticResource LogoGeometry}"/>
|
||||
</hc:Poptip.Content>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -2,18 +2,16 @@
|
||||
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:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:command="http://www.galasoft.ch/mvvmlight"
|
||||
DataContext="{Binding SideMenuDemo,Source={StaticResource Locator}}"
|
||||
Background="{DynamicResource RegionBrush}">
|
||||
|
||||
<hc:TransitioningContentControl>
|
||||
<hc:SideMenu BorderThickness="1" Width="200" Margin="32">
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<command:EventToCommand Command="{Binding SwitchItemCmd}" PassEventArgsToCommand="True" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<hc:Interaction.Triggers>
|
||||
<hc:EventTrigger EventName="SelectionChanged">
|
||||
<hc:EventToCommand Command="{Binding SwitchItemCmd}" PassEventArgsToCommand="True" />
|
||||
</hc:EventTrigger>
|
||||
</hc:Interaction.Triggers>
|
||||
<hc:SideMenuItem Header="Overview">
|
||||
<hc:SideMenuItem.Icon>
|
||||
<Image Source="/HandyControlDemo;component/Resources/Img/DevOps/DevOps-Overview.png" Width="24" Height="24"/>
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
<Border hc:ScrollViewer.IsInertiaEnabled="True"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:command="http://www.galasoft.ch/mvvmlight"
|
||||
x:Class="HandyControlDemo.UserControl.LeftMainContent"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Background="{DynamicResource RegionBrush}"
|
||||
@@ -61,11 +59,11 @@
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</TabControl.ContentTemplate>
|
||||
<i:Interaction.Triggers>
|
||||
<i:EventTrigger EventName="SelectionChanged">
|
||||
<command:EventToCommand Command="{Binding SwitchDemoCmd}" PassEventArgsToCommand="True" />
|
||||
</i:EventTrigger>
|
||||
</i:Interaction.Triggers>
|
||||
<hc:Interaction.Triggers>
|
||||
<hc:EventTrigger EventName="SelectionChanged">
|
||||
<hc:EventToCommand Command="{Binding SwitchDemoCmd}" PassEventArgsToCommand="True" />
|
||||
</hc:EventTrigger>
|
||||
</hc:Interaction.Triggers>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit"
|
||||
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>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition/>
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace HandyControl.Collections
|
||||
{
|
||||
[Serializable]
|
||||
public class ManualObservableCollection<T> : Collection<T>, INotifyCollectionChanged, INotifyPropertyChanged
|
||||
{
|
||||
private SimpleMonitor _monitor = new SimpleMonitor();
|
||||
|
||||
private const string CountString = "Count";
|
||||
|
||||
private const string IndexerName = "Item[]";
|
||||
|
||||
private bool _canNotify = true;
|
||||
|
||||
public bool CanNotify
|
||||
{
|
||||
get => _canNotify;
|
||||
set
|
||||
{
|
||||
_canNotify = value;
|
||||
|
||||
if (value)
|
||||
{
|
||||
if (_oldCount != Count)
|
||||
{
|
||||
OnPropertyChanged(CountString);
|
||||
}
|
||||
|
||||
OnPropertyChanged(IndexerName);
|
||||
OnCollectionReset();
|
||||
}
|
||||
else
|
||||
{
|
||||
_oldCount = Count;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private int _oldCount;
|
||||
|
||||
public event NotifyCollectionChangedEventHandler CollectionChanged;
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
public ManualObservableCollection()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// ReSharper disable once AssignNullToNotNullAttribute
|
||||
public ManualObservableCollection(List<T> list) : base(list != null ? new List<T>(list.Count) : list) => CopyFrom(list);
|
||||
|
||||
public ManualObservableCollection(IEnumerable<T> collection)
|
||||
{
|
||||
if (collection == null) throw new ArgumentNullException(nameof(collection));
|
||||
CopyFrom(collection);
|
||||
}
|
||||
|
||||
private void CopyFrom(IEnumerable<T> collection)
|
||||
{
|
||||
var items = Items;
|
||||
if (collection != null)
|
||||
{
|
||||
using var enumerator = collection.GetEnumerator();
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
items.Add(enumerator.Current);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Move(int oldIndex, int newIndex) => MoveItem(oldIndex, newIndex);
|
||||
|
||||
protected override void ClearItems()
|
||||
{
|
||||
CheckReentrancy();
|
||||
base.ClearItems();
|
||||
OnPropertyChanged(CountString);
|
||||
OnPropertyChanged(IndexerName);
|
||||
OnCollectionReset();
|
||||
}
|
||||
|
||||
protected override void RemoveItem(int index)
|
||||
{
|
||||
CheckReentrancy();
|
||||
var removedItem = this[index];
|
||||
|
||||
base.RemoveItem(index);
|
||||
|
||||
OnPropertyChanged(CountString);
|
||||
OnPropertyChanged(IndexerName);
|
||||
OnCollectionChanged(NotifyCollectionChangedAction.Remove, removedItem, index);
|
||||
}
|
||||
|
||||
protected override void InsertItem(int index, T item)
|
||||
{
|
||||
CheckReentrancy();
|
||||
base.InsertItem(index, item);
|
||||
|
||||
OnPropertyChanged(CountString);
|
||||
OnPropertyChanged(IndexerName);
|
||||
OnCollectionChanged(NotifyCollectionChangedAction.Add, item, index);
|
||||
}
|
||||
|
||||
protected override void SetItem(int index, T item)
|
||||
{
|
||||
CheckReentrancy();
|
||||
var originalItem = this[index];
|
||||
base.SetItem(index, item);
|
||||
|
||||
OnPropertyChanged(IndexerName);
|
||||
OnCollectionChanged(NotifyCollectionChangedAction.Replace, originalItem, item, index);
|
||||
}
|
||||
|
||||
protected virtual void MoveItem(int oldIndex, int newIndex)
|
||||
{
|
||||
CheckReentrancy();
|
||||
|
||||
var removedItem = this[oldIndex];
|
||||
|
||||
base.RemoveItem(oldIndex);
|
||||
base.InsertItem(newIndex, removedItem);
|
||||
|
||||
OnPropertyChanged(IndexerName);
|
||||
OnCollectionChanged(NotifyCollectionChangedAction.Move, removedItem, newIndex, oldIndex);
|
||||
}
|
||||
|
||||
protected virtual void OnPropertyChanged(PropertyChangedEventArgs e)
|
||||
{
|
||||
if (!CanNotify || PropertyChanged == null) return;
|
||||
|
||||
PropertyChanged.Invoke(this, e);
|
||||
}
|
||||
|
||||
protected virtual void OnCollectionChanged(NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
if (!CanNotify || CollectionChanged == null) return;
|
||||
|
||||
using (BlockReentrancy())
|
||||
{
|
||||
// ReSharper disable once PossibleNullReferenceException
|
||||
CollectionChanged(this, e);
|
||||
}
|
||||
}
|
||||
|
||||
protected IDisposable BlockReentrancy()
|
||||
{
|
||||
_monitor.Enter();
|
||||
return _monitor;
|
||||
}
|
||||
|
||||
protected void CheckReentrancy()
|
||||
{
|
||||
if (_monitor.Busy && CollectionChanged != null && CollectionChanged.GetInvocationList().Length > 1)
|
||||
{
|
||||
throw new InvalidOperationException("ObservableCollectionReentrancyNotAllowed");
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPropertyChanged(string propertyName) =>
|
||||
OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
|
||||
|
||||
private void OnCollectionChanged(NotifyCollectionChangedAction action, object item, int index) =>
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(action, item, index));
|
||||
|
||||
private void OnCollectionChanged(NotifyCollectionChangedAction action, object item, int index, int oldIndex) =>
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(action, item, index, oldIndex));
|
||||
|
||||
private void OnCollectionChanged(NotifyCollectionChangedAction action, object oldItem, object newItem, int index) =>
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(action, newItem, oldItem, index));
|
||||
|
||||
private void OnCollectionReset() =>
|
||||
OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
|
||||
|
||||
private class SimpleMonitor : IDisposable
|
||||
{
|
||||
public void Enter() => ++_busyCount;
|
||||
|
||||
public void Dispose() => --_busyCount;
|
||||
|
||||
public bool Busy => _busyCount > 0;
|
||||
|
||||
private int _busyCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,11 +13,11 @@ namespace HandyControl.Controls
|
||||
public static Visibility GetVisibility(DependencyObject element) => (Visibility) element.GetValue(VisibilityProperty);
|
||||
|
||||
public static readonly DependencyProperty PlacementProperty = DependencyProperty.RegisterAttached(
|
||||
"Placement", typeof(TipPlacement), typeof(TipElement), new PropertyMetadata(default(TipPlacement)));
|
||||
"Placement", typeof(PlacementType), typeof(TipElement), new PropertyMetadata(default(PlacementType)));
|
||||
|
||||
public static void SetPlacement(DependencyObject element, TipPlacement value) => element.SetValue(PlacementProperty, value);
|
||||
public static void SetPlacement(DependencyObject element, PlacementType value) => element.SetValue(PlacementProperty, value);
|
||||
|
||||
public static TipPlacement GetPlacement(DependencyObject element) => (TipPlacement) element.GetValue(PlacementProperty);
|
||||
public static PlacementType GetPlacement(DependencyObject element) => (PlacementType) element.GetValue(PlacementProperty);
|
||||
|
||||
public static readonly DependencyProperty StringFormatProperty = DependencyProperty.RegisterAttached(
|
||||
"StringFormat", typeof(string), typeof(TipElement), new PropertyMetadata("#0.0"));
|
||||
|
||||
@@ -80,7 +80,10 @@ namespace HandyControl.Controls
|
||||
{
|
||||
if (d is System.Windows.Window window)
|
||||
{
|
||||
if ((bool)e.NewValue)
|
||||
var v = (bool) e.NewValue;
|
||||
window.SetCurrentValue(System.Windows.Window.ShowInTaskbarProperty, v);
|
||||
|
||||
if (v)
|
||||
{
|
||||
window.SourceInitialized -= Window_SourceInitialized;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace HandyControl.Controls
|
||||
if (!_colorPicker.IsMouseOver && window.IsMouseOver)
|
||||
{
|
||||
UpdateCursor(true);
|
||||
if (e.Message == MouseHookMessageType.LeftButtonDown)
|
||||
if (e.MessageType == MouseHookMessageType.LeftButtonDown)
|
||||
{
|
||||
var brush = new SolidColorBrush(GetColorAt(e.Point.X, e.Point.Y));
|
||||
_colorPicker.SelectedBrush = brush;
|
||||
|
||||
@@ -4,9 +4,11 @@ using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Media.Media3D;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools.Extension;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
@@ -27,7 +29,7 @@ namespace HandyControl.Controls
|
||||
/// <summary>
|
||||
/// 最大显示数量的一半
|
||||
/// </summary>
|
||||
private const int MaxShowCountHalf = 7;
|
||||
private const int MaxShowCountHalf = 3;
|
||||
|
||||
/// <summary>
|
||||
/// 页码
|
||||
@@ -55,7 +57,7 @@ namespace HandyControl.Controls
|
||||
private static void OnPageIndexChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||
{
|
||||
var ctl = (CoverFlow)d;
|
||||
ctl.UpdateIndex((int)e.NewValue, (int)e.OldValue);
|
||||
ctl.UpdateIndex((int)e.NewValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -72,13 +74,15 @@ namespace HandyControl.Controls
|
||||
/// <summary>
|
||||
/// 当前在显示范围内的项
|
||||
/// </summary>
|
||||
private readonly Dictionary<int, CoverFlowItem> _itemShowList = new Dictionary<int, CoverFlowItem>();
|
||||
private readonly Dictionary<int, CoverFlowItem> _itemShowDic = new Dictionary<int, CoverFlowItem>();
|
||||
|
||||
/// <summary>
|
||||
/// 相机
|
||||
/// </summary>
|
||||
private ProjectionCamera _camera;
|
||||
|
||||
private Point3DAnimation _point3DAnimation;
|
||||
|
||||
/// <summary>
|
||||
/// 3d画布
|
||||
/// </summary>
|
||||
@@ -127,7 +131,7 @@ namespace HandyControl.Controls
|
||||
if (_viewport3D != null)
|
||||
{
|
||||
_viewport3D.Children.Clear();
|
||||
_itemShowList.Clear();
|
||||
_itemShowDic.Clear();
|
||||
_viewport3D.MouseLeftButtonDown -= Viewport3D_MouseLeftButtonDown;
|
||||
}
|
||||
|
||||
@@ -148,7 +152,9 @@ namespace HandyControl.Controls
|
||||
PageIndex = _jumpToIndex;
|
||||
_jumpToIndex = -1;
|
||||
}
|
||||
_camera.Position = new Point3D(CoverFlowItem.Interval * PageIndex, _camera.Position.Y, _camera.Position.Z);
|
||||
|
||||
_point3DAnimation = new Point3DAnimation(new Point3D(CoverFlowItem.Interval * PageIndex, _camera.Position.Y, _camera.Position.Z), new Duration(TimeSpan.FromMilliseconds(200)));
|
||||
_camera.BeginAnimation(ProjectionCamera.PositionProperty, _point3DAnimation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -204,24 +210,17 @@ namespace HandyControl.Controls
|
||||
/// <param name="pos"></param>
|
||||
private void Remove(int pos)
|
||||
{
|
||||
if (!_itemShowList.TryGetValue(pos, out var item)) return;
|
||||
if (!_itemShowDic.TryGetValue(pos, out var item)) return;
|
||||
_visualParent.Children.Remove(item);
|
||||
_itemShowList.Remove(pos);
|
||||
_itemShowDic.Remove(pos);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移动项到指定的位置
|
||||
/// </summary>
|
||||
/// <param name="index"></param>
|
||||
/// <param name="animated"></param>
|
||||
private void Move(int index, bool animated) => _itemShowList[index].Move(PageIndex, animated);
|
||||
|
||||
private void Viewport3D_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
var result = (RayMeshGeometry3DHitTestResult)VisualTreeHelper.HitTest(_viewport3D, e.GetPosition(_viewport3D));
|
||||
if (result != null)
|
||||
{
|
||||
foreach (var item in _itemShowList.Values)
|
||||
foreach (var item in _itemShowDic.Values)
|
||||
{
|
||||
if (item.HitTest(result.MeshHit))
|
||||
{
|
||||
@@ -236,35 +235,25 @@ namespace HandyControl.Controls
|
||||
/// 更新项的位置
|
||||
/// </summary>
|
||||
/// <param name="newIndex"></param>
|
||||
/// <param name="oldIndex"></param>
|
||||
private void UpdateIndex(int newIndex, int oldIndex)
|
||||
private void UpdateIndex(int newIndex)
|
||||
{
|
||||
var animate = Math.Abs(newIndex - oldIndex) < MaxShowCountHalf;
|
||||
UpdateShowRange();
|
||||
if (newIndex > oldIndex)
|
||||
_itemShowDic.Do(item =>
|
||||
{
|
||||
if (oldIndex < _firstShowIndex)
|
||||
if (item.Value.Index < _firstShowIndex || item.Value.Index > _lastShowIndex)
|
||||
{
|
||||
oldIndex = _firstShowIndex;
|
||||
Remove(item.Value.Index);
|
||||
}
|
||||
for (var i = oldIndex; i <= newIndex; i++)
|
||||
else
|
||||
{
|
||||
Move(i, animate);
|
||||
item.Value.Move(PageIndex);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oldIndex > _lastShowIndex)
|
||||
{
|
||||
oldIndex = _lastShowIndex;
|
||||
}
|
||||
for (var i = oldIndex; i >= newIndex; i--)
|
||||
{
|
||||
Move(i, animate);
|
||||
}
|
||||
}
|
||||
_camera.Position = new Point3D(CoverFlowItem.Interval * newIndex, _camera.Position.Y,
|
||||
_camera.Position.Z);
|
||||
});
|
||||
|
||||
_point3DAnimation = new Point3DAnimation(new Point3D(CoverFlowItem.Interval * newIndex, _camera.Position.Y,
|
||||
_camera.Position.Z), new Duration(TimeSpan.FromMilliseconds(200)));
|
||||
|
||||
_camera.BeginAnimation(ProjectionCamera.PositionProperty, _point3DAnimation);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -275,27 +264,12 @@ namespace HandyControl.Controls
|
||||
var newFirstShowIndex = Math.Max(PageIndex - MaxShowCountHalf, 0);
|
||||
var newLastShowIndex = Math.Min(PageIndex + MaxShowCountHalf, _contentDic.Count - 1);
|
||||
|
||||
if (_firstShowIndex < newFirstShowIndex)
|
||||
{
|
||||
for (var i = _firstShowIndex; i < newFirstShowIndex; i++)
|
||||
{
|
||||
Remove(i);
|
||||
}
|
||||
}
|
||||
else if (newLastShowIndex < _lastShowIndex)
|
||||
{
|
||||
for (var i = newLastShowIndex; i < _lastShowIndex; i++)
|
||||
{
|
||||
Remove(i);
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = newFirstShowIndex; i <= newLastShowIndex; i++)
|
||||
{
|
||||
if (!_itemShowList.ContainsKey(i))
|
||||
if (!_itemShowDic.ContainsKey(i))
|
||||
{
|
||||
var cover = CreateCoverFlowItem(i, _contentDic[i]);
|
||||
_itemShowList[i] = cover;
|
||||
_itemShowDic[i] = cover;
|
||||
_visualParent.Children.Add(cover);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,23 +124,14 @@ namespace HandyControl.Controls
|
||||
/// <summary>
|
||||
/// 移动
|
||||
/// </summary>
|
||||
internal void Move(int currentIndex, bool animated)
|
||||
internal void Move(int currentIndex)
|
||||
{
|
||||
if (animated || _rotation3D.HasAnimatedProperties)
|
||||
{
|
||||
_rotation3D.BeginAnimation(AxisAngleRotation3D.AngleProperty,
|
||||
AnimationHelper.CreateAnimation(GetAngleByPos(currentIndex), AnimationSpeed));
|
||||
_transform3D.BeginAnimation(TranslateTransform3D.OffsetXProperty,
|
||||
AnimationHelper.CreateAnimation(GetXByPos(currentIndex), AnimationSpeed));
|
||||
_transform3D.BeginAnimation(TranslateTransform3D.OffsetZProperty,
|
||||
AnimationHelper.CreateAnimation(GetZByPos(currentIndex), AnimationSpeed));
|
||||
}
|
||||
else
|
||||
{
|
||||
_rotation3D.Angle = GetAngleByPos(currentIndex);
|
||||
_transform3D.OffsetX = GetXByPos(currentIndex);
|
||||
_transform3D.OffsetZ = GetZByPos(currentIndex);
|
||||
}
|
||||
_rotation3D.BeginAnimation(AxisAngleRotation3D.AngleProperty,
|
||||
AnimationHelper.CreateAnimation(GetAngleByPos(currentIndex), AnimationSpeed));
|
||||
_transform3D.BeginAnimation(TranslateTransform3D.OffsetXProperty,
|
||||
AnimationHelper.CreateAnimation(GetXByPos(currentIndex), AnimationSpeed));
|
||||
_transform3D.BeginAnimation(TranslateTransform3D.OffsetZProperty,
|
||||
AnimationHelper.CreateAnimation(GetZByPos(currentIndex), AnimationSpeed));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -106,19 +106,19 @@ namespace HandyControl.Controls
|
||||
set => SetValue(OffsetProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty PlacementProperty = DependencyProperty.RegisterAttached(
|
||||
"Placement", typeof(TipPlacement), typeof(Poptip), new PropertyMetadata(TipPlacement.Top));
|
||||
public static readonly DependencyProperty PlacementTypeProperty = DependencyProperty.RegisterAttached(
|
||||
"PlacementType", typeof(PlacementType), typeof(Poptip), new PropertyMetadata(PlacementType.Top));
|
||||
|
||||
public static void SetPlacement(DependencyObject element, TipPlacement value)
|
||||
=> element.SetValue(PlacementProperty, value);
|
||||
public static void SetPlacement(DependencyObject element, PlacementType value)
|
||||
=> element.SetValue(PlacementTypeProperty, value);
|
||||
|
||||
public static TipPlacement GetPlacement(DependencyObject element)
|
||||
=> (TipPlacement) element.GetValue(PlacementProperty);
|
||||
public static PlacementType GetPlacement(DependencyObject element)
|
||||
=> (PlacementType) element.GetValue(PlacementTypeProperty);
|
||||
|
||||
public TipPlacement Placement
|
||||
public PlacementType PlacementType
|
||||
{
|
||||
get => (TipPlacement)GetValue(PlacementProperty);
|
||||
set => SetValue(PlacementProperty, value);
|
||||
get => (PlacementType)GetValue(PlacementTypeProperty);
|
||||
set => SetValue(PlacementTypeProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsOpenProperty = DependencyProperty.RegisterAttached(
|
||||
@@ -192,65 +192,65 @@ namespace HandyControl.Controls
|
||||
var offsetY = .0;
|
||||
|
||||
var poptip = (Poptip)GetInstance(Target);
|
||||
var popupPlacement = poptip.Placement;
|
||||
var popupPlacement = poptip.PlacementType;
|
||||
var popupOffset = poptip.Offset;
|
||||
|
||||
PlacementMode placementMode;
|
||||
|
||||
switch (popupPlacement)
|
||||
{
|
||||
case TipPlacement.LeftTop:
|
||||
case PlacementType.LeftTop:
|
||||
offsetX = -popupOffset;
|
||||
placementMode = PlacementMode.Left;
|
||||
break;
|
||||
case TipPlacement.Left:
|
||||
case PlacementType.Left:
|
||||
offsetX = -popupOffset;
|
||||
offsetY = (targetHeight - height) / 2;
|
||||
placementMode = PlacementMode.Left;
|
||||
break;
|
||||
case TipPlacement.LeftBottom:
|
||||
case PlacementType.LeftBottom:
|
||||
offsetX = -popupOffset;
|
||||
offsetY = targetHeight - height;
|
||||
placementMode = PlacementMode.Left;
|
||||
break;
|
||||
case TipPlacement.TopLeft:
|
||||
case PlacementType.TopLeft:
|
||||
offsetY = -popupOffset;
|
||||
placementMode = PlacementMode.Top;
|
||||
break;
|
||||
case TipPlacement.Top:
|
||||
case PlacementType.Top:
|
||||
offsetX = (targetWidth - width) / 2;
|
||||
offsetY = -popupOffset;
|
||||
placementMode = PlacementMode.Top;
|
||||
break;
|
||||
case TipPlacement.TopRight:
|
||||
case PlacementType.TopRight:
|
||||
offsetX = targetWidth - width;
|
||||
offsetY = -popupOffset;
|
||||
placementMode = PlacementMode.Top;
|
||||
break;
|
||||
case TipPlacement.RightTop:
|
||||
case PlacementType.RightTop:
|
||||
offsetX = popupOffset;
|
||||
placementMode = PlacementMode.Right;
|
||||
break;
|
||||
case TipPlacement.Right:
|
||||
case PlacementType.Right:
|
||||
offsetX = popupOffset;
|
||||
offsetY = (targetHeight - height) / 2;
|
||||
placementMode = PlacementMode.Right;
|
||||
break;
|
||||
case TipPlacement.RightBottom:
|
||||
case PlacementType.RightBottom:
|
||||
offsetX = popupOffset;
|
||||
offsetY = targetHeight - height;
|
||||
placementMode = PlacementMode.Right;
|
||||
break;
|
||||
case TipPlacement.BottomLeft:
|
||||
case PlacementType.BottomLeft:
|
||||
offsetY = popupOffset;
|
||||
placementMode = PlacementMode.Bottom;
|
||||
break;
|
||||
case TipPlacement.Bottom:
|
||||
case PlacementType.Bottom:
|
||||
offsetX = (targetWidth - width) / 2;
|
||||
offsetY = popupOffset;
|
||||
placementMode = PlacementMode.Bottom;
|
||||
break;
|
||||
case TipPlacement.BottomRight:
|
||||
case PlacementType.BottomRight:
|
||||
offsetX = targetWidth - width;
|
||||
offsetY = popupOffset;
|
||||
placementMode = PlacementMode.Bottom;
|
||||
@@ -271,7 +271,7 @@ namespace HandyControl.Controls
|
||||
if (!GetIsInstance(Target))
|
||||
{
|
||||
SetCurrentValue(ContentProperty, GetContent(Target));
|
||||
SetCurrentValue(PlacementProperty, GetPlacement(Target));
|
||||
SetCurrentValue(PlacementTypeProperty, GetPlacement(Target));
|
||||
SetCurrentValue(HitModeProperty, GetHitMode(Target));
|
||||
SetCurrentValue(OffsetProperty, GetOffset(Target));
|
||||
SetCurrentValue(IsOpenProperty, GetIsOpen(Target));
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
public class Screenshot
|
||||
{
|
||||
public static event EventHandler<FunctionEventArgs<ImageSource>> Snapped;
|
||||
|
||||
public void Start() => new ScreenshotWindow(this).Show();
|
||||
|
||||
internal void OnSnapped(ImageSource source) => Snapped?.Invoke(this, new FunctionEventArgs<ImageSource>(source));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,669 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools;
|
||||
using HandyControl.Tools.Extension;
|
||||
using HandyControl.Tools.Interop;
|
||||
|
||||
namespace HandyControl.Controls
|
||||
{
|
||||
[TemplatePart(Name = ElementCanvas, Type = typeof(InkCanvas))]
|
||||
[TemplatePart(Name = ElementMaskAreaLeft, Type = typeof(FrameworkElement))]
|
||||
[TemplatePart(Name = ElementMaskAreaTop, Type = typeof(FrameworkElement))]
|
||||
[TemplatePart(Name = ElementMaskAreaRight, Type = typeof(FrameworkElement))]
|
||||
[TemplatePart(Name = ElementMaskAreaBottom, Type = typeof(FrameworkElement))]
|
||||
[TemplatePart(Name = ElementTargetArea, Type = typeof(InkCanvas))]
|
||||
[TemplatePart(Name = ElementMagnifier, Type = typeof(FrameworkElement))]
|
||||
public class ScreenshotWindow : System.Windows.Window
|
||||
{
|
||||
#region fields
|
||||
|
||||
private readonly Screenshot _screenshot;
|
||||
|
||||
private VisualBrush _visualPreview;
|
||||
|
||||
private Size _viewboxSize;
|
||||
|
||||
private BitmapSource _imageSource;
|
||||
|
||||
#region const
|
||||
|
||||
private const int IntervalLength = 1;
|
||||
|
||||
private const int IntervalBigLength = 10;
|
||||
|
||||
private const int SnapLength = 4;
|
||||
|
||||
#endregion
|
||||
|
||||
#region IntPtr
|
||||
|
||||
private IntPtr _desktopWindowHandle;
|
||||
|
||||
private IntPtr _mouseOverWindowHandle;
|
||||
|
||||
private readonly IntPtr _screenshotWindowHandle;
|
||||
|
||||
#endregion
|
||||
|
||||
#region status
|
||||
|
||||
private InteropValues.RECT _desktopWindowRect;
|
||||
|
||||
private InteropValues.RECT _targetWindowRect;
|
||||
|
||||
private readonly int[] _flagArr = new int[4];
|
||||
|
||||
private bool _isOut;
|
||||
|
||||
private bool _canDrag;
|
||||
|
||||
private bool _receiveMoveMsg = true;
|
||||
|
||||
private Point _mousePointOld;
|
||||
|
||||
private Point _pointFixed;
|
||||
|
||||
private InteropValues.POINT _pointFloating;
|
||||
|
||||
private bool _saveScreenshot;
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Elements
|
||||
|
||||
internal InkCanvas Canvas { get; set; }
|
||||
|
||||
internal FrameworkElement MaskAreaLeft { get; set; }
|
||||
|
||||
internal FrameworkElement MaskAreaTop { get; set; }
|
||||
|
||||
internal FrameworkElement MaskAreaRight { get; set; }
|
||||
|
||||
internal FrameworkElement MaskAreaBottom { get; set; }
|
||||
|
||||
internal FrameworkElement TargetArea { get; set; }
|
||||
|
||||
private FrameworkElement _magnifier;
|
||||
|
||||
#endregion
|
||||
|
||||
#region const
|
||||
|
||||
private const string ElementCanvas = "PART_Canvas";
|
||||
|
||||
private const string ElementMaskAreaLeft = "PART_MaskAreaLeft";
|
||||
|
||||
private const string ElementMaskAreaTop = "PART_MaskAreaTop";
|
||||
|
||||
private const string ElementMaskAreaRight = "PART_MaskAreaRight";
|
||||
|
||||
private const string ElementMaskAreaBottom = "PART_MaskAreaBottom";
|
||||
|
||||
private const string ElementTargetArea = "PART_TargetArea";
|
||||
|
||||
private const string ElementMagnifier = "PART_Magnifier";
|
||||
|
||||
#endregion
|
||||
|
||||
#region prop
|
||||
|
||||
public static readonly DependencyProperty IsDrawingProperty = DependencyProperty.Register(
|
||||
"IsDrawing", typeof(bool), typeof(ScreenshotWindow), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
public bool IsDrawing
|
||||
{
|
||||
get => (bool)GetValue(IsDrawingProperty);
|
||||
internal set => SetValue(IsDrawingProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty IsSelectingProperty = DependencyProperty.Register(
|
||||
"IsSelecting", typeof(bool), typeof(ScreenshotWindow), new PropertyMetadata(ValueBoxes.FalseBox));
|
||||
|
||||
public bool IsSelecting
|
||||
{
|
||||
get => (bool)GetValue(IsSelectingProperty);
|
||||
internal set => SetValue(IsSelectingProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SizeProperty = DependencyProperty.Register(
|
||||
"Size", typeof(Size), typeof(ScreenshotWindow), new PropertyMetadata(default(Size)));
|
||||
|
||||
public Size Size
|
||||
{
|
||||
get => (Size) GetValue(SizeProperty);
|
||||
internal set => SetValue(SizeProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SizeStrProperty = DependencyProperty.Register(
|
||||
"SizeStr", typeof(string), typeof(ScreenshotWindow), new PropertyMetadata(default(string)));
|
||||
|
||||
public string SizeStr
|
||||
{
|
||||
get => (string) GetValue(SizeStrProperty);
|
||||
internal set => SetValue(SizeStrProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty PixelColorProperty = DependencyProperty.Register(
|
||||
"PixelColor", typeof(Color), typeof(ScreenshotWindow), new PropertyMetadata(default(Color)));
|
||||
|
||||
public Color PixelColor
|
||||
{
|
||||
get => (Color) GetValue(PixelColorProperty);
|
||||
internal set => SetValue(PixelColorProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty PixelColorStrProperty = DependencyProperty.Register(
|
||||
"PixelColorStr", typeof(string), typeof(ScreenshotWindow), new PropertyMetadata(default(string)));
|
||||
|
||||
public string PixelColorStr
|
||||
{
|
||||
get => (string) GetValue(PixelColorStrProperty);
|
||||
internal set => SetValue(PixelColorStrProperty, value);
|
||||
}
|
||||
|
||||
public static readonly DependencyPropertyKey PreviewBrushPropertyKey = DependencyProperty.RegisterReadOnly(
|
||||
"PreviewBrush", typeof(Brush), typeof(ScreenshotWindow), new PropertyMetadata(default(Brush)));
|
||||
|
||||
public static readonly DependencyProperty PreviewBrushProperty = PreviewBrushPropertyKey.DependencyProperty;
|
||||
|
||||
public Brush PreviewBrush
|
||||
{
|
||||
get => (Brush) GetValue(PreviewBrushProperty);
|
||||
set => SetValue(PreviewBrushProperty, value);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public ScreenshotWindow(Screenshot screenshot)
|
||||
{
|
||||
Style = ResourceHelper.GetResource<Style>(ResourceToken.Window4ScreenshotStyle);
|
||||
_screenshot = screenshot;
|
||||
DataContext = this;
|
||||
|
||||
_screenshotWindowHandle = this.GetHandle();
|
||||
InteropMethods.EnableWindow(_screenshotWindowHandle, false);
|
||||
|
||||
Loaded += ScreenshotWindow_Loaded;
|
||||
Closed += ScreenshotWindow_Closed;
|
||||
}
|
||||
|
||||
public override void OnApplyTemplate()
|
||||
{
|
||||
base.OnApplyTemplate();
|
||||
|
||||
Canvas = GetTemplateChild(ElementCanvas) as InkCanvas;
|
||||
MaskAreaLeft = GetTemplateChild(ElementMaskAreaLeft) as FrameworkElement;
|
||||
MaskAreaTop = GetTemplateChild(ElementMaskAreaTop) as FrameworkElement;
|
||||
MaskAreaRight = GetTemplateChild(ElementMaskAreaRight) as FrameworkElement;
|
||||
MaskAreaBottom = GetTemplateChild(ElementMaskAreaBottom) as FrameworkElement;
|
||||
TargetArea = GetTemplateChild(ElementTargetArea) as FrameworkElement;
|
||||
_magnifier = GetTemplateChild(ElementMagnifier) as FrameworkElement;
|
||||
|
||||
if (_magnifier != null)
|
||||
{
|
||||
_viewboxSize = new Size(29, 21);
|
||||
}
|
||||
|
||||
_visualPreview = new VisualBrush(Canvas)
|
||||
{
|
||||
ViewboxUnits = BrushMappingMode.Absolute
|
||||
};
|
||||
SetValue(PreviewBrushPropertyKey, _visualPreview);
|
||||
_magnifier.Show();
|
||||
}
|
||||
|
||||
protected override void OnPreviewKeyDown(KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Escape) Close();
|
||||
|
||||
if (IsDrawing)
|
||||
{
|
||||
switch (e.Key)
|
||||
{
|
||||
case Key.Left:
|
||||
{
|
||||
MoveTargetArea(MoveRect(_targetWindowRect, -1, rightFlag: -1));
|
||||
}
|
||||
break;
|
||||
case Key.Up:
|
||||
{
|
||||
MoveTargetArea(MoveRect(_targetWindowRect, bottomFlag: -1, topFlag: -1));
|
||||
}
|
||||
break;
|
||||
case Key.Right:
|
||||
{
|
||||
MoveTargetArea(MoveRect(_targetWindowRect, 1, rightFlag: 1));
|
||||
}
|
||||
break;
|
||||
case Key.Down:
|
||||
{
|
||||
MoveTargetArea(MoveRect(_targetWindowRect, bottomFlag: 1, topFlag: 1));
|
||||
}
|
||||
break;
|
||||
case Key.Enter:
|
||||
_saveScreenshot = true;
|
||||
Close();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPreviewMouseLeftButtonDown(MouseButtonEventArgs e) => _mousePointOld = e.GetPosition(this);
|
||||
|
||||
protected override void OnPreviewMouseLeftButtonUp(MouseButtonEventArgs e) => _magnifier.Collapse();
|
||||
|
||||
protected override void OnPreviewMouseDoubleClick(MouseButtonEventArgs e)
|
||||
{
|
||||
_saveScreenshot = true;
|
||||
Close();
|
||||
}
|
||||
|
||||
protected override void OnPreviewMouseMove(MouseEventArgs e)
|
||||
{
|
||||
if (e.LeftButton != MouseButtonState.Pressed)
|
||||
{
|
||||
UpdateStatus(e.GetPosition(TargetArea));
|
||||
return;
|
||||
}
|
||||
|
||||
var newPoint = Mouse.GetPosition(this);
|
||||
var offsetX = (int)(newPoint.X - _mousePointOld.X);
|
||||
var offsetY = (int)(newPoint.Y - _mousePointOld.Y);
|
||||
|
||||
if (IsDrawing)
|
||||
{
|
||||
if (_isOut) return;
|
||||
var rect = _targetWindowRect;
|
||||
|
||||
if (_canDrag)
|
||||
{
|
||||
rect.Left += offsetX;
|
||||
rect.Top += offsetY;
|
||||
rect.Right += offsetX;
|
||||
rect.Bottom += offsetY;
|
||||
}
|
||||
else
|
||||
{
|
||||
var magnifierPos = new InteropValues.POINT((int) newPoint.X, (int) newPoint.Y);
|
||||
|
||||
if (_flagArr[0] > 0)
|
||||
{
|
||||
_pointFloating.X += offsetX * _flagArr[0];
|
||||
magnifierPos.X = _pointFloating.X;
|
||||
}
|
||||
else if (_flagArr[2] > 0)
|
||||
{
|
||||
_pointFloating.X += offsetX * _flagArr[2];
|
||||
magnifierPos.X = _pointFloating.X - 1;
|
||||
}
|
||||
|
||||
if (_flagArr[1] > 0)
|
||||
{
|
||||
_pointFloating.Y += offsetY * _flagArr[1];
|
||||
magnifierPos.Y = _pointFloating.Y;
|
||||
}
|
||||
else if (_flagArr[3] > 0)
|
||||
{
|
||||
_pointFloating.Y += offsetY * _flagArr[3];
|
||||
magnifierPos.Y = _pointFloating.Y - 1;
|
||||
}
|
||||
|
||||
rect.Left = (int)Math.Min(_pointFixed.X, _pointFloating.X);
|
||||
rect.Top = (int)Math.Min(_pointFixed.Y, _pointFloating.Y);
|
||||
rect.Right = (int)Math.Max(_pointFixed.X, _pointFloating.X);
|
||||
rect.Bottom = (int)Math.Max(_pointFixed.Y, _pointFloating.Y);
|
||||
|
||||
_magnifier.Show();
|
||||
MoveMagnifier(magnifierPos);
|
||||
}
|
||||
|
||||
MoveTargetArea(rect);
|
||||
_mousePointOld = newPoint;
|
||||
}
|
||||
else if (IsSelecting)
|
||||
{
|
||||
var minX = (int)Math.Min(_mousePointOld.X, newPoint.X);
|
||||
var maxX = (int)Math.Max(_mousePointOld.X, newPoint.X);
|
||||
var minY = (int)Math.Min(_mousePointOld.Y, newPoint.Y);
|
||||
var maxY = (int)Math.Max(_mousePointOld.Y, newPoint.Y);
|
||||
|
||||
MoveTargetArea(new InteropValues.RECT(minX, minY, maxX, maxY));
|
||||
}
|
||||
else if (!IsSelecting && offsetX > 0 && offsetY > 0)
|
||||
{
|
||||
IsSelecting = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void ScreenshotWindow_Closed(object sender, EventArgs e)
|
||||
{
|
||||
if (_saveScreenshot)
|
||||
{
|
||||
SaveScreenshot();
|
||||
}
|
||||
|
||||
StopHooks();
|
||||
IsDrawing = false;
|
||||
|
||||
Loaded -= ScreenshotWindow_Loaded;
|
||||
Closed -= ScreenshotWindow_Closed;
|
||||
}
|
||||
|
||||
private void ScreenshotWindow_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
_imageSource = GetDesktopSnapshot();
|
||||
var image = new Image
|
||||
{
|
||||
Source = _imageSource
|
||||
};
|
||||
RenderOptions.SetBitmapScalingMode(image, BitmapScalingMode.NearestNeighbor);
|
||||
Canvas.Children.Add(image);
|
||||
StartHooks();
|
||||
InteropMethods.GetCursorPos(out var point);
|
||||
MoveElement(point);
|
||||
MoveMagnifier(point);
|
||||
}
|
||||
|
||||
private void UpdateStatus(Point point)
|
||||
{
|
||||
Cursor cursor;
|
||||
|
||||
var leftAbs = Math.Abs(point.X);
|
||||
var topAbs = Math.Abs(point.Y);
|
||||
var rightAbs = Math.Abs(point.X - _targetWindowRect.Width);
|
||||
var downAbs = Math.Abs(point.Y - _targetWindowRect.Height);
|
||||
|
||||
_canDrag = false;
|
||||
_isOut = false;
|
||||
_flagArr[0] = 0;
|
||||
_flagArr[1] = 0;
|
||||
_flagArr[2] = 0;
|
||||
_flagArr[3] = 0;
|
||||
|
||||
if (leftAbs <= SnapLength)
|
||||
{
|
||||
if (topAbs > SnapLength)
|
||||
{
|
||||
if (downAbs > SnapLength)
|
||||
{
|
||||
// left
|
||||
cursor = Cursors.SizeWE;
|
||||
_pointFixed = new Point(_targetWindowRect.Right, _targetWindowRect.Top);
|
||||
_pointFloating = new InteropValues.POINT(_targetWindowRect.Left, _targetWindowRect.Bottom);
|
||||
_flagArr[0] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//left bottom
|
||||
cursor = Cursors.SizeNESW;
|
||||
_pointFixed = new Point(_targetWindowRect.Right, _targetWindowRect.Top);
|
||||
_pointFloating = new InteropValues.POINT(_targetWindowRect.Left, _targetWindowRect.Bottom);
|
||||
_flagArr[0] = 1;
|
||||
_flagArr[3] = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// left top
|
||||
cursor = Cursors.SizeNWSE;
|
||||
_pointFixed = new Point(_targetWindowRect.Right, _targetWindowRect.Bottom);
|
||||
_pointFloating = new InteropValues.POINT(_targetWindowRect.Left, _targetWindowRect.Top);
|
||||
_flagArr[0] = 1;
|
||||
_flagArr[1] = 1;
|
||||
}
|
||||
}
|
||||
else if (rightAbs > SnapLength)
|
||||
{
|
||||
if (topAbs > SnapLength)
|
||||
{
|
||||
if (downAbs > SnapLength)
|
||||
{
|
||||
if (TargetArea.IsMouseOver)
|
||||
{
|
||||
//drag
|
||||
cursor = Cursors.SizeAll;
|
||||
_canDrag = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//out
|
||||
cursor = Cursors.Arrow;
|
||||
_isOut = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//bottom
|
||||
cursor = Cursors.SizeNS;
|
||||
_pointFixed = new Point(_targetWindowRect.Left, _targetWindowRect.Top);
|
||||
_pointFloating = new InteropValues.POINT(_targetWindowRect.Right, _targetWindowRect.Bottom);
|
||||
_flagArr[3] = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//top
|
||||
cursor = Cursors.SizeNS;
|
||||
_pointFixed = new Point(_targetWindowRect.Right, _targetWindowRect.Bottom);
|
||||
_pointFloating = new InteropValues.POINT(_targetWindowRect.Left, _targetWindowRect.Top);
|
||||
_flagArr[1] = 1;
|
||||
}
|
||||
}
|
||||
else if (rightAbs <= SnapLength)
|
||||
{
|
||||
if (topAbs > SnapLength)
|
||||
{
|
||||
if (downAbs > SnapLength)
|
||||
{
|
||||
//right
|
||||
cursor = Cursors.SizeWE;
|
||||
_pointFixed = new Point(_targetWindowRect.Left, _targetWindowRect.Bottom);
|
||||
_pointFloating = new InteropValues.POINT(_targetWindowRect.Right, _targetWindowRect.Top);
|
||||
_flagArr[2] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//right bottom
|
||||
cursor = Cursors.SizeNWSE;
|
||||
_pointFixed = new Point(_targetWindowRect.Left, _targetWindowRect.Top);
|
||||
_pointFloating = new InteropValues.POINT(_targetWindowRect.Right, _targetWindowRect.Bottom);
|
||||
_flagArr[2] = 1;
|
||||
_flagArr[3] = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// right top
|
||||
cursor = Cursors.SizeNESW;
|
||||
_pointFixed = new Point(_targetWindowRect.Left, _targetWindowRect.Bottom);
|
||||
_pointFloating = new InteropValues.POINT(_targetWindowRect.Right, _targetWindowRect.Top);
|
||||
_flagArr[1] = 1;
|
||||
_flagArr[2] = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//out
|
||||
cursor = Cursors.Arrow;
|
||||
_isOut = true;
|
||||
}
|
||||
|
||||
TargetArea.Cursor = cursor;
|
||||
}
|
||||
|
||||
private void StopHooks()
|
||||
{
|
||||
MouseHook.Stop();
|
||||
MouseHook.StatusChanged -= MouseHook_StatusChanged;
|
||||
}
|
||||
|
||||
private void StartHooks()
|
||||
{
|
||||
MouseHook.Start();
|
||||
MouseHook.StatusChanged += MouseHook_StatusChanged;
|
||||
}
|
||||
|
||||
private void MouseHook_StatusChanged(object sender, MouseHookEventArgs e)
|
||||
{
|
||||
switch (e.MessageType)
|
||||
{
|
||||
case MouseHookMessageType.MouseMove:
|
||||
MoveElement(e.Point);
|
||||
MoveMagnifier(e.Point);
|
||||
break;
|
||||
case MouseHookMessageType.LeftButtonDown:
|
||||
_receiveMoveMsg = false;
|
||||
_mousePointOld = new Point(e.Point.X, e.Point.Y);
|
||||
InteropMethods.EnableWindow(_screenshotWindowHandle, true);
|
||||
break;
|
||||
case MouseHookMessageType.RightButtonDown:
|
||||
if (!IsDrawing) Close();
|
||||
break;
|
||||
case MouseHookMessageType.LeftButtonUp:
|
||||
StopHooks();
|
||||
IsSelecting = false;
|
||||
IsDrawing = true;
|
||||
_magnifier.Collapse();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveScreenshot()
|
||||
{
|
||||
var cb = new CroppedBitmap(_imageSource, new Int32Rect(_targetWindowRect.Left, _targetWindowRect.Top, _targetWindowRect.Width, _targetWindowRect.Height));
|
||||
_screenshot.OnSnapped(cb);
|
||||
|
||||
Close();
|
||||
}
|
||||
|
||||
private BitmapSource GetDesktopSnapshot()
|
||||
{
|
||||
_desktopWindowHandle = InteropMethods.GetDesktopWindow();
|
||||
var hdcSrc = InteropMethods.GetWindowDC(_desktopWindowHandle);
|
||||
var hdcDest = InteropMethods.CreateCompatibleDC(hdcSrc);
|
||||
|
||||
InteropMethods.GetWindowRect(_desktopWindowHandle, out _desktopWindowRect);
|
||||
var desktopWindowWidth = _desktopWindowRect.Right - _desktopWindowRect.Left;
|
||||
var desktopWindowHeight = _desktopWindowRect.Bottom - _desktopWindowRect.Top;
|
||||
|
||||
var bitmap = InteropMethods.CreateCompatibleBitmap(hdcSrc, desktopWindowWidth, desktopWindowHeight);
|
||||
var hOld = InteropMethods.SelectObject(hdcDest, bitmap);
|
||||
InteropMethods.BitBlt(hdcDest, 0, 0, desktopWindowWidth, desktopWindowHeight, hdcSrc, 0, 0, InteropValues.SRCCOPY);
|
||||
InteropMethods.SelectObject(hdcDest, hOld);
|
||||
InteropMethods.DeleteDC(hdcDest);
|
||||
InteropMethods.ReleaseDC(_desktopWindowHandle, hdcSrc);
|
||||
return Imaging.CreateBitmapSourceFromHBitmap(bitmap, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());
|
||||
}
|
||||
|
||||
private void MoveElement(InteropValues.POINT point)
|
||||
{
|
||||
if (!_receiveMoveMsg) return;
|
||||
|
||||
var mouseOverWindowHandle = InteropMethods.ChildWindowFromPointEx(_desktopWindowHandle,
|
||||
new InteropValues.POINT
|
||||
{
|
||||
X = point.X,
|
||||
Y = point.Y
|
||||
}, 1 | 2);
|
||||
|
||||
if (mouseOverWindowHandle != _mouseOverWindowHandle && mouseOverWindowHandle != IntPtr.Zero)
|
||||
{
|
||||
_mouseOverWindowHandle = mouseOverWindowHandle;
|
||||
|
||||
InteropMethods.GetWindowRect(_mouseOverWindowHandle, out var windowRect);
|
||||
MoveTargetArea(windowRect);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
rect.Right -= rect.Left;
|
||||
rect.Left = 0;
|
||||
}
|
||||
|
||||
if (rect.Top < 0)
|
||||
{
|
||||
rect.Bottom -= rect.Top;
|
||||
rect.Top = 0;
|
||||
}
|
||||
|
||||
if (rect.Right > _desktopWindowRect.Width)
|
||||
{
|
||||
rect.Left -= rect.Right - _desktopWindowRect.Width;
|
||||
rect.Right = _desktopWindowRect.Width;
|
||||
}
|
||||
|
||||
if (rect.Bottom > _desktopWindowRect.Height)
|
||||
{
|
||||
rect.Top -= rect.Bottom - _desktopWindowRect.Height;
|
||||
rect.Bottom = _desktopWindowRect.Height;
|
||||
}
|
||||
|
||||
rect.Left = Math.Max(0, rect.Left);
|
||||
rect.Top = Math.Max(0, rect.Top);
|
||||
|
||||
var width = rect.Width;
|
||||
var height = rect.Height;
|
||||
var left = rect.Left;
|
||||
var top = rect.Top;
|
||||
|
||||
TargetArea.Width = width;
|
||||
TargetArea.Height = height;
|
||||
TargetArea.Margin = new Thickness(left, top, 0, 0);
|
||||
|
||||
_targetWindowRect = new InteropValues.RECT(left, top, left + width, top + height);
|
||||
Size = _targetWindowRect.Size;
|
||||
SizeStr = $"{_targetWindowRect.Width} x {_targetWindowRect.Height}";
|
||||
|
||||
MoveMaskArea();
|
||||
}
|
||||
|
||||
private void MoveMaskArea()
|
||||
{
|
||||
MaskAreaLeft.Width = TargetArea.Margin.Left;
|
||||
MaskAreaLeft.Height = _desktopWindowRect.Height;
|
||||
|
||||
MaskAreaTop.Margin = new Thickness(TargetArea.Margin.Left, 0, 0, 0);
|
||||
MaskAreaTop.Width = TargetArea.Width;
|
||||
MaskAreaTop.Height = TargetArea.Margin.Top;
|
||||
|
||||
MaskAreaRight.Margin = new Thickness(TargetArea.Width + TargetArea.Margin.Left, 0, 0, 0);
|
||||
MaskAreaRight.Width = _desktopWindowRect.Width - TargetArea.Margin.Left - TargetArea.Width;
|
||||
MaskAreaRight.Height = _desktopWindowRect.Height;
|
||||
|
||||
MaskAreaBottom.Margin = new Thickness(TargetArea.Margin.Left, TargetArea.Height + TargetArea.Margin.Top, 0, 0);
|
||||
MaskAreaBottom.Width = TargetArea.Width;
|
||||
MaskAreaBottom.Height = _desktopWindowRect.Height - TargetArea.Height - TargetArea.Margin.Top;
|
||||
}
|
||||
|
||||
private void MoveMagnifier(InteropValues.POINT point)
|
||||
{
|
||||
_magnifier.Margin = new Thickness(point.X + 4, point.Y + 26, 0, 0);
|
||||
_visualPreview.Viewbox = new Rect(new Point(point.X - _viewboxSize.Width / 2 + 0.5, point.Y - _viewboxSize.Height / 2 + 0.5), _viewboxSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -304,7 +304,7 @@ namespace HandyControl.Controls
|
||||
_tempNonClientAreaHeight = NonClientAreaHeight;
|
||||
NonClientAreaHeight += 8;
|
||||
}
|
||||
else if (WindowState == WindowState.Normal)
|
||||
else
|
||||
{
|
||||
BorderThickness = _actualBorderThickness;
|
||||
NonClientAreaHeight = _tempNonClientAreaHeight;
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace HandyControl.Data
|
||||
{
|
||||
internal class MouseHookEventArgs : EventArgs
|
||||
{
|
||||
public MouseHookMessageType Message { get; set; }
|
||||
public MouseHookMessageType MessageType { get; set; }
|
||||
|
||||
public InteropValues.POINT Point { get; set; }
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
|
||||
namespace HandyControl.Data
|
||||
{
|
||||
public enum PlacementType
|
||||
{
|
||||
/// <summary>
|
||||
/// 左上
|
||||
/// </summary>
|
||||
LeftTop,
|
||||
|
||||
/// <summary>
|
||||
/// 左
|
||||
/// </summary>
|
||||
Left,
|
||||
|
||||
/// <summary>
|
||||
/// 左下
|
||||
/// </summary>
|
||||
LeftBottom,
|
||||
|
||||
/// <summary>
|
||||
/// 上左
|
||||
/// </summary>
|
||||
TopLeft,
|
||||
|
||||
/// <summary>
|
||||
/// 上
|
||||
/// </summary>
|
||||
Top,
|
||||
|
||||
/// <summary>
|
||||
/// 上右
|
||||
/// </summary>
|
||||
TopRight,
|
||||
|
||||
/// <summary>
|
||||
/// 右上
|
||||
/// </summary>
|
||||
RightTop,
|
||||
|
||||
/// <summary>
|
||||
/// 右
|
||||
/// </summary>
|
||||
Right,
|
||||
|
||||
/// <summary>
|
||||
/// 右下
|
||||
/// </summary>
|
||||
RightBottom,
|
||||
|
||||
/// <summary>
|
||||
/// 下左
|
||||
/// </summary>
|
||||
BottomLeft,
|
||||
|
||||
/// <summary>
|
||||
/// 下
|
||||
/// </summary>
|
||||
Bottom,
|
||||
|
||||
/// <summary>
|
||||
/// 下右
|
||||
/// </summary>
|
||||
BottomRight,
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
namespace HandyControl.Data
|
||||
{
|
||||
public enum TipPlacement
|
||||
public enum PlacementType
|
||||
{
|
||||
/// <summary>
|
||||
/// 左上
|
||||
|
||||
@@ -306,6 +306,8 @@
|
||||
|
||||
internal const string WindowGlow = nameof(WindowGlow);
|
||||
|
||||
internal const string Window4ScreenshotStyle = nameof(Window4ScreenshotStyle);
|
||||
|
||||
internal const string AddTagButtonStyle = nameof(AddTagButtonStyle);
|
||||
|
||||
internal const string RadioGroupItemDefault = nameof(RadioGroupItemDefault);
|
||||
@@ -355,7 +357,7 @@
|
||||
internal const string TabItemCapsuleVerticalFirst = nameof(TabItemCapsuleVerticalFirst);
|
||||
|
||||
internal const string TabItemCapsuleVerticalLast = nameof(TabItemCapsuleVerticalLast);
|
||||
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -9,6 +9,7 @@
|
||||
<Import_RootNamespace>HandyControl</Import_RootNamespace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Collections\ManualObservableCollection!1.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\BackgroundSwitchElement.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\BorderElement.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Attach\DataGridAttach.cs" />
|
||||
@@ -33,10 +34,12 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Card.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Notification.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Poptip.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Screenshot\Screenshot.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Other\Sprite.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Block\ToggleBlock.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Panel\HoneycombPanel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Panel\RelativePanel.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Screenshot\ScreenshotWindow.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeTrack.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\RangeThumb.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Controls\Slider\RangeSlider\TwoWayRangeBase.cs" />
|
||||
@@ -58,6 +61,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\HwndWrapper.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\CloseWindowCommand.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\EasingGeometryKeyFrame.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Media\Animation\GeometryAnimation.cs" />
|
||||
@@ -197,7 +201,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\SkinType.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\StepStatus.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\TextType.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\TipPlacement.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\PlacementType.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Enum\TitleAlignment.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Gif\GifFrameDimension.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Data\Gif\GifImageInfo.cs" />
|
||||
@@ -247,9 +251,9 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Expression\Shapes\PrimitiveShape.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\AdornerContainer.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\AttachableCollection!1.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Behavior!1.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Behavior.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\BehaviorCollection.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Behavior\Behavior!1.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Behavior\Behavior.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Behavior\BehaviorCollection.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Commands\ControlCommands.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\DefaultTriggerAttribute.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\EventToCommand.cs" />
|
||||
@@ -258,14 +262,14 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\EventTriggerBase.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\ExceptionStringTable.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\ExtendedVisualStateManager.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\FluidMoveBehavior.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\FluidMoveBehaviorBase.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Behavior\FluidMoveBehavior.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Behavior\FluidMoveBehaviorBase.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\FluidMoveScope.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\IAttachedObject.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\IEventArgsConverter.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Interaction.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\InvokeCommandAction.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\MouseDragElementBehavior.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Behavior\MouseDragElementBehavior.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\NameResolvedEventArgs.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\NameResolver.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\PreviewInvokeEventArgs.cs" />
|
||||
@@ -332,7 +336,7 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Interop\InteropValues.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Interop\Handle\SafeFileMappingHandle.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Interop\Handle\WpfSafeHandle.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\MouseDragElementBehaviorEx.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Interactivity\Behavior\MouseDragElementBehaviorEx.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Pool\IPool!1.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Pool\SimplePool!1.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Tools\Pool\SynchronizedPool!1.cs" />
|
||||
@@ -403,6 +407,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\Screenshot.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)Themes\Styles\BlendEffectBox.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -161,5 +161,10 @@ namespace HandyControl.Interactivity
|
||||
/// 关闭窗口
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="clr-namespace:HandyControl.Controls">
|
||||
|
||||
<Style x:Key="MaskRect4ScreenshotStyle" TargetType="Rectangle">
|
||||
<Setter Property="IsHitTestVisible" Value="False"/>
|
||||
<Setter Property="Fill" Value="{DynamicResource DarkOpacityBrush}"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="SnapRect4ScreenshotStyle" TargetType="Rectangle">
|
||||
<Setter Property="Height" Value="5"/>
|
||||
<Setter Property="Width" Value="5"/>
|
||||
<Setter Property="Fill" Value="DodgerBlue"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||
<Setter Property="Visibility" Value="Collapsed"/>
|
||||
<Style.Triggers>
|
||||
<Trigger Property="controls:TipElement.Placement" Value="LeftTop">
|
||||
<Setter Property="Margin" Value="-3, -3, 0, 0"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||
</Trigger>
|
||||
<Trigger Property="controls:TipElement.Placement" Value="Top">
|
||||
<Setter Property="Margin" Value="0, -3, 0, 0"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||
</Trigger>
|
||||
<Trigger Property="controls:TipElement.Placement" Value="RightTop">
|
||||
<Setter Property="Margin" Value="0, -3, -3, 0"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||
</Trigger>
|
||||
<Trigger Property="controls:TipElement.Placement" Value="Right">
|
||||
<Setter Property="Margin" Value="0, 0, -3, 0"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Trigger>
|
||||
<Trigger Property="controls:TipElement.Placement" Value="RightBottom">
|
||||
<Setter Property="Margin" Value="0, 0, -3, -3"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Right"/>
|
||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||
</Trigger>
|
||||
<Trigger Property="controls:TipElement.Placement" Value="Bottom">
|
||||
<Setter Property="Margin" Value="0, 0, 0, -3"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||
</Trigger>
|
||||
<Trigger Property="controls:TipElement.Placement" Value="LeftBottom">
|
||||
<Setter Property="Margin" Value="-3, 0, 0, -3"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Bottom"/>
|
||||
</Trigger>
|
||||
<Trigger Property="controls:TipElement.Placement" Value="Left">
|
||||
<Setter Property="Margin" Value="-3, 0, 0, 0"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||
</Trigger>
|
||||
<DataTrigger Binding="{Binding IsSelecting}" Value="True">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsDrawing}" Value="True">
|
||||
<Setter Property="Visibility" Value="Visible"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="TargetArea4ScreenshotStyle" TargetType="Border">
|
||||
<Setter Property="IsHitTestVisible" Value="False"/>
|
||||
<Setter Property="BorderThickness" Value="5"/>
|
||||
<Setter Property="BorderBrush" Value="DodgerBlue"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="HorizontalAlignment" Value="Left"/>
|
||||
<Setter Property="VerticalAlignment" Value="Top"/>
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsSelecting}" Value="True">
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsDrawing}" Value="True">
|
||||
<Setter Property="IsHitTestVisible" Value="True"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Window4ScreenshotStyle" TargetType="controls:ScreenshotWindow">
|
||||
<Setter Property="UseLayoutRounding" Value="True"/>
|
||||
<Setter Property="WindowStyle" Value="None"/>
|
||||
<Setter Property="WindowState" Value="Maximized"/>
|
||||
<Setter Property="Topmost" Value="True"/>
|
||||
<Setter Property="AllowsTransparency" Value="True"/>
|
||||
<Setter Property="ResizeMode" Value="NoResize"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="controls:WindowAttach.IgnoreAltF4" Value="True"/>
|
||||
<Setter Property="controls:WindowAttach.ShowInTaskManager" Value="False"/>
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="controls:ScreenshotWindow">
|
||||
<AdornerDecorator>
|
||||
<controls:SimplePanel>
|
||||
<InkCanvas EditingMode="None" Name="PART_Canvas" Background="Transparent"/>
|
||||
<Rectangle Name="PART_MaskAreaLeft" Style="{StaticResource MaskRect4ScreenshotStyle}"/>
|
||||
<Rectangle Name="PART_MaskAreaTop" Style="{StaticResource MaskRect4ScreenshotStyle}"/>
|
||||
<Rectangle Name="PART_MaskAreaRight" Style="{StaticResource MaskRect4ScreenshotStyle}"/>
|
||||
<Rectangle Name="PART_MaskAreaBottom" Style="{StaticResource MaskRect4ScreenshotStyle}"/>
|
||||
<Border Name="PART_TargetArea" Style="{StaticResource TargetArea4ScreenshotStyle}">
|
||||
<controls:SimplePanel>
|
||||
<Rectangle controls:TipElement.Placement="LeftTop" Style="{StaticResource SnapRect4ScreenshotStyle}"/>
|
||||
<Rectangle controls:TipElement.Placement="Top" Style="{StaticResource SnapRect4ScreenshotStyle}"/>
|
||||
<Rectangle controls:TipElement.Placement="RightTop" Style="{StaticResource SnapRect4ScreenshotStyle}"/>
|
||||
<Rectangle controls:TipElement.Placement="Right" Style="{StaticResource SnapRect4ScreenshotStyle}"/>
|
||||
<Rectangle controls:TipElement.Placement="RightBottom" Style="{StaticResource SnapRect4ScreenshotStyle}"/>
|
||||
<Rectangle controls:TipElement.Placement="Bottom" Style="{StaticResource SnapRect4ScreenshotStyle}"/>
|
||||
<Rectangle controls:TipElement.Placement="LeftBottom" Style="{StaticResource SnapRect4ScreenshotStyle}"/>
|
||||
<Rectangle controls:TipElement.Placement="Left" Style="{StaticResource SnapRect4ScreenshotStyle}"/>
|
||||
<TextBlock Text="{TemplateBinding SizeStr}" Background="#CC212121" Foreground="White" HorizontalAlignment="Left" VerticalAlignment="Top" Padding="8,2"/>
|
||||
</controls:SimplePanel>
|
||||
</Border>
|
||||
<Border x:Name="PART_Magnifier" IsHitTestVisible="False" Visibility="Collapsed" HorizontalAlignment="Left" VerticalAlignment="Top" Width="122" Height="122" BorderThickness="1" BorderBrush="#FF333333" CornerRadius="1">
|
||||
<Border.Effect>
|
||||
<DropShadowEffect BlurRadius="2" Opacity=".2" Direction="-45" RenderingBias="Performance" ShadowDepth="3"/>
|
||||
</Border.Effect>
|
||||
<controls:SimplePanel>
|
||||
<Border Margin="0,0,0,32" Background="{TemplateBinding PreviewBrush}" BorderThickness="2" BorderBrush="White">
|
||||
<controls:SimplePanel>
|
||||
<Path Data="M56,0 L60,0 60,40 116,40 116,44 60,44 60,84 56,84 56,44 0,44 0,40 56,40 z" Fill="#CC4CC6FF"/>
|
||||
</controls:SimplePanel>
|
||||
</Border>
|
||||
<Border Height="32" VerticalAlignment="Bottom" Background="#CC000000">
|
||||
<StackPanel VerticalAlignment="Center" Margin="5,0,0,0">
|
||||
<TextBlock Foreground="White" Text="{TemplateBinding SizeStr}"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</controls:SimplePanel>
|
||||
</Border>
|
||||
</controls:SimplePanel>
|
||||
</AdornerDecorator>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -85,6 +85,7 @@
|
||||
<ResourceDictionary Source="NavigationWindow.xaml"/>
|
||||
<ResourceDictionary Source="Frame.xaml"/>
|
||||
<ResourceDictionary Source="BlendEffectBox.xaml"/>
|
||||
<ResourceDictionary Source="Screenshot.xaml"/>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
|
||||
</ResourceDictionary>
|
||||
@@ -9,37 +9,25 @@ namespace HandyControl.Tools.Extension
|
||||
/// 显示元素
|
||||
/// </summary>
|
||||
/// <param name="element"></param>
|
||||
public static void Show(this UIElement element)
|
||||
{
|
||||
element.Visibility = Visibility.Visible;
|
||||
}
|
||||
public static void Show(this UIElement element) => element.Visibility = Visibility.Visible;
|
||||
|
||||
/// <summary>
|
||||
/// 显示元素
|
||||
/// </summary>
|
||||
/// <param name="element"></param>
|
||||
/// <param name="show"></param>
|
||||
public static void Show(this UIElement element, bool show)
|
||||
{
|
||||
element.Visibility = show ? Visibility.Visible : Visibility.Collapsed;
|
||||
}
|
||||
public static void Show(this UIElement element, bool show) => element.Visibility = show ? Visibility.Visible : Visibility.Collapsed;
|
||||
|
||||
/// <summary>
|
||||
/// 不现实元素,但保留空间
|
||||
/// </summary>
|
||||
/// <param name="element"></param>
|
||||
public static void Hide(this UIElement element)
|
||||
{
|
||||
element.Visibility = Visibility.Hidden;
|
||||
}
|
||||
public static void Hide(this UIElement element) => element.Visibility = Visibility.Hidden;
|
||||
|
||||
/// <summary>
|
||||
/// 不显示元素,且不保留空间
|
||||
/// </summary>
|
||||
/// <param name="element"></param>
|
||||
public static void Collapse(this UIElement element)
|
||||
{
|
||||
element.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
public static void Collapse(this UIElement element) => element.Visibility = Visibility.Collapsed;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows;
|
||||
@@ -18,7 +17,6 @@ namespace HandyControl.Tools
|
||||
|
||||
static GlobalShortcut()
|
||||
{
|
||||
|
||||
KeyboardHook.KeyDown += KeyboardHook_KeyDown;
|
||||
}
|
||||
|
||||
@@ -51,21 +49,6 @@ namespace HandyControl.Tools
|
||||
key == Key.RightCtrl || key == Key.RightAlt || key == Key.RightShift || key == Key.RWin;
|
||||
}
|
||||
|
||||
[Obsolete("pls use Host attach property instead of Init method")]
|
||||
public static void Init(DependencyObject host)
|
||||
{
|
||||
CommandDic.Clear();
|
||||
|
||||
if (host == null) return;
|
||||
|
||||
KeyBindingCollection = GetKeyBindings(host);
|
||||
if (KeyBindingCollection == null || KeyBindingCollection.Count == 0) return;
|
||||
|
||||
AddKeyBindings(KeyBindingCollection);
|
||||
|
||||
KeyboardHook.Start();
|
||||
}
|
||||
|
||||
private static void AddKeyBindings(IEnumerable<KeyBinding> keyBindings)
|
||||
{
|
||||
foreach (var item in keyBindings)
|
||||
|
||||
@@ -6,32 +6,43 @@ namespace HandyControl.Tools
|
||||
{
|
||||
public class ClipboardHook
|
||||
{
|
||||
public static event Action ContentChanged;
|
||||
|
||||
private static HwndSource HWndSource;
|
||||
|
||||
private static IntPtr HookId = IntPtr.Zero;
|
||||
|
||||
public static event Action ContentChanged;
|
||||
private static int Count;
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
if (HookId != IntPtr.Zero)
|
||||
if (HookId == IntPtr.Zero)
|
||||
{
|
||||
Stop();
|
||||
HookId = WindowHelper.CreateHandle();
|
||||
HWndSource = HwndSource.FromHwnd(HookId);
|
||||
if (HWndSource != null)
|
||||
{
|
||||
HWndSource.AddHook(WinProc);
|
||||
InteropMethods.AddClipboardFormatListener(HookId);
|
||||
}
|
||||
}
|
||||
|
||||
HookId = WindowHelper.CreateHandle();
|
||||
HWndSource = HwndSource.FromHwnd(HookId);
|
||||
if (HWndSource != null)
|
||||
if (HookId != IntPtr.Zero)
|
||||
{
|
||||
HWndSource.AddHook(WinProc);
|
||||
InteropMethods.AddClipboardFormatListener(HookId);
|
||||
Count++;
|
||||
}
|
||||
}
|
||||
|
||||
public static void Stop()
|
||||
{
|
||||
HWndSource.RemoveHook(WinProc);
|
||||
InteropMethods.RemoveClipboardFormatListener(HookId);
|
||||
Count--;
|
||||
if (Count < 1)
|
||||
{
|
||||
HWndSource.RemoveHook(WinProc);
|
||||
InteropMethods.RemoveClipboardFormatListener(HookId);
|
||||
|
||||
HookId = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
private static IntPtr WinProc(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam, ref bool handled)
|
||||
|
||||
@@ -26,29 +26,42 @@ namespace HandyControl.Tools
|
||||
|
||||
private static readonly IntPtr SyskeyUpIntPtr = (IntPtr)InteropValues.WM_SYSKEYUP;
|
||||
|
||||
private static int Count;
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
if (HookId == IntPtr.Zero)
|
||||
{
|
||||
HookId = SetHook(Proc);
|
||||
}
|
||||
|
||||
if (HookId != IntPtr.Zero)
|
||||
{
|
||||
Stop();
|
||||
Count++;
|
||||
}
|
||||
HookId = SetHook(Proc);
|
||||
}
|
||||
|
||||
public static void Stop() => InteropMethods.UnhookWindowsHookEx(HookId);
|
||||
public static void Stop()
|
||||
{
|
||||
Count--;
|
||||
if (Count < 1)
|
||||
{
|
||||
InteropMethods.UnhookWindowsHookEx(HookId);
|
||||
HookId = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
private static IntPtr SetHook(InteropValues.HookProc proc)
|
||||
{
|
||||
using (var curProcess = Process.GetCurrentProcess())
|
||||
using (var curModule = curProcess.MainModule)
|
||||
using var curProcess = Process.GetCurrentProcess();
|
||||
using var curModule = curProcess.MainModule;
|
||||
|
||||
if (curModule != null)
|
||||
{
|
||||
if (curModule != null)
|
||||
{
|
||||
return InteropMethods.SetWindowsHookEx((int)InteropValues.HookType.WH_KEYBOARD_LL, proc,
|
||||
InteropMethods.GetModuleHandle(curModule.ModuleName), 0);
|
||||
}
|
||||
return IntPtr.Zero;
|
||||
return InteropMethods.SetWindowsHookEx((int)InteropValues.HookType.WH_KEYBOARD_LL, proc,
|
||||
InteropMethods.GetModuleHandle(curModule.ModuleName), 0);
|
||||
}
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
|
||||
|
||||
@@ -14,29 +14,42 @@ namespace HandyControl.Tools
|
||||
|
||||
private static readonly InteropValues.HookProc Proc = HookCallback;
|
||||
|
||||
private static int Count;
|
||||
|
||||
public static void Start()
|
||||
{
|
||||
if (HookId == IntPtr.Zero)
|
||||
{
|
||||
HookId = SetHook(Proc);
|
||||
}
|
||||
|
||||
if (HookId != IntPtr.Zero)
|
||||
{
|
||||
Stop();
|
||||
Count++;
|
||||
}
|
||||
HookId = SetHook(Proc);
|
||||
}
|
||||
|
||||
public static void Stop() => InteropMethods.UnhookWindowsHookEx(HookId);
|
||||
public static void Stop()
|
||||
{
|
||||
Count--;
|
||||
if (Count < 1)
|
||||
{
|
||||
InteropMethods.UnhookWindowsHookEx(HookId);
|
||||
HookId = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
private static IntPtr SetHook(InteropValues.HookProc proc)
|
||||
{
|
||||
using (var curProcess = Process.GetCurrentProcess())
|
||||
using (var curModule = curProcess.MainModule)
|
||||
using var curProcess = Process.GetCurrentProcess();
|
||||
using var curModule = curProcess.MainModule;
|
||||
|
||||
if (curModule != null)
|
||||
{
|
||||
if (curModule != null)
|
||||
{
|
||||
return InteropMethods.SetWindowsHookEx((int)InteropValues.HookType.WH_MOUSE_LL, proc,
|
||||
InteropMethods.GetModuleHandle(curModule.ModuleName), 0);
|
||||
}
|
||||
return IntPtr.Zero;
|
||||
return InteropMethods.SetWindowsHookEx((int)InteropValues.HookType.WH_MOUSE_LL, proc,
|
||||
InteropMethods.GetModuleHandle(curModule.ModuleName), 0);
|
||||
}
|
||||
return IntPtr.Zero;
|
||||
}
|
||||
|
||||
private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
|
||||
@@ -45,7 +58,7 @@ namespace HandyControl.Tools
|
||||
var hookStruct = (InteropValues.MOUSEHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(InteropValues.MOUSEHOOKSTRUCT));
|
||||
StatusChanged?.Invoke(null, new MouseHookEventArgs
|
||||
{
|
||||
Message = (MouseHookMessageType)wParam,
|
||||
MessageType = (MouseHookMessageType)wParam,
|
||||
Point = new InteropValues.POINT(hookStruct.pt.X, hookStruct.pt.Y)
|
||||
});
|
||||
|
||||
|
||||
@@ -239,11 +239,6 @@ namespace HandyControl.Tools.Interop
|
||||
IntPtr hInstance,
|
||||
IntPtr lpParam);
|
||||
|
||||
[SecurityCritical]
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
|
||||
internal static extern short RegisterClass(InteropValues.WNDCLASS wc);
|
||||
|
||||
[SecurityCritical]
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[DllImport(InteropValues.ExternDll.User32, CharSet = CharSet.Unicode, SetLastError = true, BestFitMapping = false)]
|
||||
@@ -438,5 +433,18 @@ namespace HandyControl.Tools.Interop
|
||||
internal static extern bool AlphaBlend(IntPtr hdcDest, int xoriginDest, int yoriginDest, int wDest, int hDest, IntPtr hdcSrc, int xoriginSrc, int yoriginSrc, int wSrc, int hSrc, InteropValues.BLENDFUNCTION pfn);
|
||||
|
||||
internal static int GET_SC_WPARAM(IntPtr wParam) => (int)wParam & 65520;
|
||||
|
||||
[DllImport(InteropValues.ExternDll.User32)]
|
||||
internal static extern IntPtr ChildWindowFromPointEx(IntPtr hwndParent, InteropValues.POINT pt, int uFlags);
|
||||
|
||||
[DllImport(InteropValues.ExternDll.Gdi32)]
|
||||
internal static extern IntPtr CreateCompatibleBitmap(IntPtr hDC, int width, int height);
|
||||
|
||||
[DllImport(InteropValues.ExternDll.Gdi32)]
|
||||
internal static extern bool BitBlt(IntPtr hDC, int x, int y, int nWidth, int nHeight, IntPtr hSrcDC, int xSrc, int ySrc, int dwRop);
|
||||
|
||||
[DllImport(InteropValues.ExternDll.User32)]
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
internal static extern bool EnableWindow(IntPtr hWnd, bool enable);
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,8 @@ namespace HandyControl.Tools.Interop
|
||||
SC_MOVE = 0xF010,
|
||||
SC_MINIMIZE = 0xF020,
|
||||
SC_MAXIMIZE = 0xF030,
|
||||
SC_RESTORE = 0xF120;
|
||||
SC_RESTORE = 0xF120,
|
||||
SRCCOPY = 0x00CC0020;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
||||
internal class NOTIFYICONDATA
|
||||
@@ -212,6 +213,14 @@ namespace HandyControl.Tools.Interop
|
||||
public int Right;
|
||||
public int Bottom;
|
||||
|
||||
public RECT(int left, int top, int right, int bottom)
|
||||
{
|
||||
Left = left;
|
||||
Top = top;
|
||||
Right = right;
|
||||
Bottom = bottom;
|
||||
}
|
||||
|
||||
public RECT(Rect rect)
|
||||
{
|
||||
Left = (int)rect.Left;
|
||||
|
||||
Reference in new issue
Block a user