Skip to content

Commit 746b507

Browse files
committed
update in ScreenCapture
1 parent 9a3b72b commit 746b507

File tree

5 files changed

+24
-16
lines changed

5 files changed

+24
-16
lines changed

src/WPFDevelopers.Net45x/Themes/Theme.xaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5306,23 +5306,23 @@
53065306
<Border x:Name="PART_EditBar" Panel.ZIndex="99" Background="{DynamicResource WD.BackgroundSolidColorBrush}" Effect="{StaticResource WD.PopupShadowDepth}" Visibility="Hidden">
53075307
<WrapPanel Margin="10,5" VerticalAlignment="Center">
53085308
<RadioButton x:Name="PART_RadioButtonRectangle" Margin="4,0" Style="{DynamicResource WD.PathRadioButton}" ToolTip="方框">
5309-
<controls:PathIcon Width="18" Height="18" Foreground="{StaticResource WD.RegularTextSolidColorBrush}" Kind="Rectangle" />
5309+
<controls:PathIcon Width="18" Height="18" Foreground="{DynamicResource WD.RegularTextSolidColorBrush}" Kind="Rectangle" />
53105310
</RadioButton>
53115311
<RadioButton x:Name="PART_RadioButtonEllipse" Margin="4,0" Style="{DynamicResource WD.PathRadioButton}" ToolTip="椭圆">
53125312
<Ellipse Width="19" Height="19" SnapsToDevicePixels="True" Stroke="{DynamicResource WD.RegularTextSolidColorBrush}" StrokeThickness="1.5" UseLayoutRounding="True" />
53135313
</RadioButton>
53145314
<RadioButton x:Name="PART_RadioButtonArrow" Margin="4,0" Style="{DynamicResource WD.PathRadioButton}" ToolTip="箭头">
5315-
<controls:PathIcon Width="18" Height="18" Foreground="{StaticResource WD.RegularTextSolidColorBrush}" Kind="ArrowRightTop" />
5315+
<controls:PathIcon Width="18" Height="18" Foreground="{DynamicResource WD.RegularTextSolidColorBrush}" Kind="ArrowRightTop" />
53165316
</RadioButton>
53175317
<RadioButton x:Name="PART_RadioButtonInk" Margin="4,0" Style="{DynamicResource WD.PathRadioButton}" ToolTip="画笔">
5318-
<controls:PathIcon Width="18" Height="18" Foreground="{StaticResource WD.RegularTextSolidColorBrush}" Kind="Ink" />
5318+
<controls:PathIcon Width="18" Height="18" Foreground="{DynamicResource WD.RegularTextSolidColorBrush}" Kind="Ink" />
53195319
</RadioButton>
53205320
<RadioButton x:Name="PART_RadioButtonText" Margin="4,0" Style="{DynamicResource WD.PathRadioButton}" ToolTip="文字">
5321-
<controls:PathIcon Width="18" Height="18" Foreground="{StaticResource WD.RegularTextSolidColorBrush}" Kind="Text" />
5321+
<controls:PathIcon Width="18" Height="18" Foreground="{DynamicResource WD.RegularTextSolidColorBrush}" Kind="Text" />
53225322
</RadioButton>
53235323
<Rectangle Width="1" Height="18" Margin="4,0" Stroke="{DynamicResource WD.SecondaryTextSolidColorBrush}" />
53245324
<Button x:Name="PART_ButtonSave" Margin="4,0" Style="{DynamicResource WD.PathButton}" ToolTip="保存">
5325-
<controls:PathIcon Width="18" Height="18" Foreground="{StaticResource WD.RegularTextSolidColorBrush}" Kind="Save" />
5325+
<controls:PathIcon Width="18" Height="18" Foreground="{DynamicResource WD.RegularTextSolidColorBrush}" Kind="Save" />
53265326
</Button>
53275327
<Button x:Name="PART_ButtonCancel" Margin="4,0" Style="{DynamicResource WD.PathButton}" ToolTip="取消">
53285328
<controls:PathIcon Width="14" Height="14" Foreground="{StaticResource WD.DangerSolidColorBrush}" Kind="Cancel" />

src/WPFDevelopers.Samples.Shared/ExampleViews/ScreenCutExample.xaml.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ private void Button_Click(object sender, RoutedEventArgs e)
3838
App.CurrentMainWindow.WindowState = WindowState.Minimized;
3939
//Thread.Sleep(1000);
4040
}
41-
screenCapturer = new ScreenCapture();
41+
ResourceDictionary resources = new ResourceDictionary();
42+
resources.Source = new Uri("pack://application:,,,/MyResources.xaml");
43+
screenCapturer = new ScreenCapture(resources: resources);
4244
screenCapturer.SnapCompleted += ScreenCapturer_SnapCompleted;
4345
screenCapturer.SnapCanceled += ScreenCapturer_SnapCanceled;
4446
screenCapturer.Capture();

src/WPFDevelopers.Shared/Controls/ScreenCut/ScreenCapture.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
using System.Collections.Generic;
2-
using System.Text.RegularExpressions;
2+
using System.Windows;
33
using System.Windows.Forms;
44
using System.Windows.Media.Imaging;
55

66
namespace WPFDevelopers.Controls.ScreenCapturer
77
{
88
public class ScreenCapture
9-
109
{
1110
/// <summary>
1211
/// 截图完成委托
@@ -30,12 +29,19 @@ public class ScreenCapture
3029
/// </summary>
3130
private bool copyToClipboard;
3231
List<ScreenCut> ScreenCuts = new List<ScreenCut>();
33-
public ScreenCapture(bool copyToClipboard = true)
32+
/// <summary>
33+
/// 资源
34+
/// </summary>
35+
private ResourceDictionary _resources;
36+
public ScreenCapture(bool copyToClipboard = true, ResourceDictionary resources = null)
3437
{
3538
this.copyToClipboard = copyToClipboard;
3639
for (var i = 0; i < Screen.AllScreens.Length; i++)
3740
{
38-
ScreenCuts.Add(CaptureScreen(i));
41+
var screen = CaptureScreen(i);
42+
if(resources != null)
43+
screen.Resources = resources;
44+
ScreenCuts.Add(screen);
3945
}
4046
}
4147
private ScreenCut CaptureScreen(int index)

src/WPFDevelopers.Shared/Themes/Basic/Light.Color.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535

3636
<Color x:Key="WD.BaseMoveColor" po:Freeze="True">#F5F7FA</Color>
3737
<SolidColorBrush
38-
x:Key=" WD.BaseMoveSolidColorBrush"
38+
x:Key="WD.BaseMoveSolidColorBrush"
3939
po:Freeze="True"
4040
Color="{StaticResource WD.BaseMoveColor}" />
4141

src/WPFDevelopers.Shared/Themes/ScreenCut.xaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
<controls:PathIcon
8282
Width="18"
8383
Height="18"
84-
Foreground="{StaticResource WD.RegularTextSolidColorBrush}"
84+
Foreground="{DynamicResource WD.RegularTextSolidColorBrush}"
8585
Kind="Rectangle" />
8686
</RadioButton>
8787
<RadioButton
@@ -105,7 +105,7 @@
105105
<controls:PathIcon
106106
Width="18"
107107
Height="18"
108-
Foreground="{StaticResource WD.RegularTextSolidColorBrush}"
108+
Foreground="{DynamicResource WD.RegularTextSolidColorBrush}"
109109
Kind="ArrowRightTop" />
110110
</RadioButton>
111111
<RadioButton
@@ -116,7 +116,7 @@
116116
<controls:PathIcon
117117
Width="18"
118118
Height="18"
119-
Foreground="{StaticResource WD.RegularTextSolidColorBrush}"
119+
Foreground="{DynamicResource WD.RegularTextSolidColorBrush}"
120120
Kind="Ink" />
121121
</RadioButton>
122122
<RadioButton
@@ -127,7 +127,7 @@
127127
<controls:PathIcon
128128
Width="18"
129129
Height="18"
130-
Foreground="{StaticResource WD.RegularTextSolidColorBrush}"
130+
Foreground="{DynamicResource WD.RegularTextSolidColorBrush}"
131131
Kind="Text" />
132132
</RadioButton>
133133
<Rectangle
@@ -143,7 +143,7 @@
143143
<controls:PathIcon
144144
Width="18"
145145
Height="18"
146-
Foreground="{StaticResource WD.RegularTextSolidColorBrush}"
146+
Foreground="{DynamicResource WD.RegularTextSolidColorBrush}"
147147
Kind="Save" />
148148
</Button>
149149
<Button

0 commit comments

Comments
 (0)