-
Notifications
You must be signed in to change notification settings - Fork 262
ScreenCapture
闫驚鏵(Jinhua Yan) edited this page Dec 2, 2023
·
7 revisions
Application.Current.Dispatcher.Invoke(new Action(delegate
{
var screenCapturer = new ScreenCapture();
screenCapturer.SnapCompleted += ScreenCapturer_SnapCompleted;
screenCapturer.SnapCanceled += ScreenCapturer_SnapCanceled;
screenCapturer.Capture();
}));
private void ScreenCapturer_SnapCanceled()
{
//Canceled
}
private void ScreenCapturer_SnapCompleted(CroppedBitmap bitmap)
{
//Completed
}
<Window.Resources>
<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>
</Window.Resources>
Dispatcher.Invoke(new Action(delegate
{
ScreenCapture screenCapturer = new ScreenCapture(resources: this.Resources);
screenCapturer.Capture();
}));