-
Notifications
You must be signed in to change notification settings - Fork 262
ScreenCapture控件建议 #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
enhancement
New feature or request
Comments
update in ScreenCapture |
1.引入WD的资源文件<Window
x:Class="WpfScreenCapture.ScreenCaptureWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:WpfScreenCapture"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:wd="https://github.com/WPFDevelopersOrg/WPFDevelopers"
Title="Window1"
Width="800"
Height="450"
mc:Ignorable="d">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Light.Blue.xaml" />
<!-- 需要注意 wd:Resources 必须在配色主题后,Theme="Dark" 为黑色皮肤 -->
<wd:Resources Theme="Light" />
<ResourceDictionary Source="pack://application:,,,/WPFDevelopers;component/Themes/Theme.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Window.Resources>
<Button
Margin="0,10"
HorizontalAlignment="Center"
VerticalAlignment="Top"
Click="Button_Click"
Content="ScreenCapture" />
</Window> 2.在弹出截图控件时将资源传入private void Button_Click(object sender, RoutedEventArgs e)
{
Dispatcher.Invoke(new Action(delegate
{
ScreenCapture screenCapturer = new ScreenCapture(resources: this.Resources);
screenCapturer.Capture();
}));
} 或者用下面的方式外部进程启动 ScreenCaptureExtprivate void Button_Click(object sender, RoutedEventArgs e)
{
ScreenCaptureExt screenCaptureExt = new ScreenCaptureExt();
screenCaptureExt.SnapCanceled += ScreenCaptureExt_SnapCanceled;
screenCaptureExt.SnapCompleted += ScreenCaptureExt_SnapCompleted;
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
当加载资源字典无法写在App.xaml时,写在Window.Resources时 ScreenCapture及ScreenCut无法正常使用
<Window.Resources>
<ResourceDictionary.MergedDictionaries>
<wd:Resources Theme="Light"/>
</ResourceDictionary.MergedDictionaries>
</Window.Resources>
The text was updated successfully, but these errors were encountered: