Pārlūkot izejas kodu

工具栏

tags/录制修改前
zhangxueyang pirms 4 gadiem
vecāks
revīzija
04b272712d

+ 3
- 0
Common/system/ImageHelper.cs Parādīt failu

@@ -158,8 +158,11 @@ namespace Common.system
158 158
         /// <returns></returns>
159 159
         public static string GetTempImagePath()
160 160
         {
161
+            TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0);
162
+            
161 163
             string TempPath=FileToolsCommon.GetFileAbsolutePath("/temp/Screenshot/");
162 164
             FileToolsCommon.CreateDirectory(TempPath);
165
+            TempPath += Convert.ToInt64(ts.TotalMilliseconds).ToString() + ".jpg";
163 166
             return TempPath;
164 167
         }
165 168
         #endregion 截图统一方法

+ 23
- 0
XHWK.Model/Model_Screenshot.cs Parādīt failu

@@ -0,0 +1,23 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Text;
5
+using System.Threading.Tasks;
6
+
7
+namespace XHWK.Model
8
+{
9
+    public class Model_Screenshot
10
+    {
11
+        private string _imgPath;
12
+        private int _subscript;
13
+        /// <summary>
14
+        /// 图片地址
15
+        /// </summary>
16
+        public string ImgPath { get => _imgPath; set => _imgPath = value; }
17
+        /// <summary>
18
+        /// 图片下标
19
+        /// </summary>
20
+        public int Subscript { get => _subscript; set => _subscript = value; }
21
+      
22
+    }
23
+}

+ 1
- 0
XHWK.Model/XHWK.Model.csproj Parādīt failu

@@ -43,6 +43,7 @@
43 43
   <ItemGroup>
44 44
     <Compile Include="Model_Canvas.cs" />
45 45
     <Compile Include="Model_Page.cs" />
46
+    <Compile Include="Model_Screenshot.cs" />
46 47
     <Compile Include="Model_UserInfo.cs" />
47 48
     <Compile Include="Model_Video.cs" />
48 49
     <Compile Include="Model_WKData.cs" />

+ 11
- 1
XHWK.WKTool/App.cs Parādīt failu

@@ -2,6 +2,7 @@
2 2
 using Common.system;
3 3
 
4 4
 using System;
5
+using System.Collections.Generic;
5 6
 using System.Diagnostics;
6 7
 using System.Threading;
7 8
 using System.Windows;
@@ -51,6 +52,10 @@ namespace XHWK.WKTool
51 52
         /// </summary>
52 53
         public static JieTuWindow W_JieTuWindow = null;
53 54
         /// <summary>
55
+        /// 批注
56
+        /// </summary>
57
+        public static PracticeWindow W_PracticeWindow = null;
58
+        /// <summary>
54 59
         /// 登陆状态 false 未登录 true已登陆
55 60
         /// </summary>
56 61
         public static bool IsLoginType = false;
@@ -60,9 +65,14 @@ namespace XHWK.WKTool
60 65
         /// </summary>
61 66
         public static long num = 9999;
62 67
         /// <summary>
63
-        /// 图片路径
68
+        /// 导入图片路径
64 69
         /// </summary>
65 70
         public static string[] Paths = new string[] { };
71
+        /// <summary>
72
+        /// 截图图片路径
73
+        /// </summary>
74
+        public static string[] JPaths = new string[999];
75
+        public static string ImgPath = string.Empty;
66 76
         #endregion
67 77
 
68 78
         [STAThread]

+ 1
- 1
XHWK.WKTool/CountdownWindow.xaml.cs Parādīt failu

@@ -98,7 +98,7 @@ namespace XHWK.WKTool
98 98
                 _state = State.End;
99 99
                 Dispatcher.Invoke(
100 100
                     DispatcherPriority.Normal,
101
-                    new Action(() => { this.Hide(); })
101
+                    new Action(() => { this.Hide(); imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown_3.png"));})
102 102
                     );
103 103
           
104 104
         }

+ 12
- 8
XHWK.WKTool/JieTuWindow.xaml.cs Parādīt failu

@@ -15,6 +15,8 @@ using System.Windows.Controls;
15 15
 using System.Windows.Input;
16 16
 using System.Windows.Media;
17 17
 using System.Windows.Media.Imaging;
18
+using XHWK.WKTool;
19
+using static XHWK.WKTool.XHMicroLessonSystemWindow;
18 20
 
19 21
 namespace ComeCapture
20 22
 {
@@ -79,7 +81,7 @@ namespace ComeCapture
79 81
                 Directory.CreateDirectory(tempPath);
80 82
             }
81 83
             string imagePath = Path.Combine(tempPath, time + ".jpg");
82
-            Background = new ImageBrush(ImageHelper.GetScreenshot(new Rectangle(0, 0, 0, 0), imagePath));
84
+            Background = new ImageBrush(ImageHelper.GetScreenshot(new Rectangle(0, 0, 0, 0), null));
83 85
         }
84 86
 
85 87
         public void initialization()
@@ -209,8 +211,8 @@ namespace ComeCapture
209 211
 
210 212
         #endregion 保存
211 213
 
212
-        ////定义事件
213
-        //public event ChangeTextHandler ChangeTextEvent;
214
+        //定义事件
215
+        public event ChangeTextHandler ChangeTextEvent;
214 216
 
215 217
         #region 获取截图
216 218
 
@@ -223,8 +225,10 @@ namespace ComeCapture
223 225
             {
224 226
                 Directory.CreateDirectory(tempPath);
225 227
             }
228
+            APP.ImgPath = string.Empty;
226 229
             string imagePath = Path.Combine(tempPath, time + ".jpg");
227
-            LogHelper.WriteInfoLog(imagePath);
230
+            APP.ImgPath = imagePath;
231
+            //LogHelper.WriteInfoLog(imagePath);
228 232
             //this.Close();
229 233
             //string imagePath = ImageHelper.GetImagePath(out string serverSavePath);
230 234
 
@@ -281,10 +285,10 @@ namespace ComeCapture
281 285
             Visibility = Visibility.Hidden;
282 286
             ShowInTaskbar = false;
283 287
             //this.Hide();
284
-            //if (ChangeTextEvent != null)
285
-            //{
286
-            //    ChangeTextEvent("关闭窗口");
287
-            //}
288
+            if (ChangeTextEvent != null)
289
+            {
290
+                ChangeTextEvent("关闭窗口");
291
+            }
288 292
         }
289 293
 
290 294
         #endregion 获取截图

+ 19
- 0
XHWK.WKTool/PracticeWindow.xaml Parādīt failu

@@ -0,0 +1,19 @@
1
+<Window x:Class="XHWK.WKTool.PracticeWindow"
2
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6
+        xmlns:local="clr-namespace:XHWK.WKTool"
7
+        mc:Ignorable="d"
8
+        Title="PracticeWindow"  Width="1280"
9
+    Height="800"
10
+    AllowsTransparency="True"
11
+    Background="Transparent"
12
+    Opacity="1"
13
+    ShowInTaskbar="False"
14
+    WindowStyle="None">
15
+    <Grid>
16
+        <Image x:Name="imgCanvas"/>
17
+        <InkCanvas Grid.Row="0" x:Name="blackboard_canvas" Background="Transparent" Visibility="Visible" Grid.ColumnSpan="2" />
18
+    </Grid>
19
+</Window>

+ 35
- 0
XHWK.WKTool/PracticeWindow.xaml.cs Parādīt failu

@@ -0,0 +1,35 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.IO;
4
+using System.Linq;
5
+using System.Text;
6
+using System.Threading.Tasks;
7
+using System.Windows;
8
+using System.Windows.Controls;
9
+using System.Windows.Data;
10
+using System.Windows.Documents;
11
+using System.Windows.Input;
12
+using System.Windows.Media;
13
+using System.Windows.Media.Imaging;
14
+using System.Windows.Shapes;
15
+
16
+namespace XHWK.WKTool
17
+{
18
+    /// <summary>
19
+    /// PracticeWindow.xaml 的交互逻辑
20
+    /// </summary>
21
+    public partial class PracticeWindow : Window
22
+    {
23
+        public PracticeWindow()
24
+        {
25
+            InitializeComponent();
26
+        }
27
+        public void Initialize(string _imgPath)
28
+        {
29
+            if(File.Exists(_imgPath))
30
+            {
31
+                imgCanvas.Source = new BitmapImage(new Uri(_imgPath));
32
+            }
33
+        }
34
+    }
35
+}

+ 16
- 14
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml Parādīt failu

@@ -18,6 +18,8 @@
18 18
                 <RowDefinition Height="auto"/>
19 19
                 <RowDefinition Height="auto"/>
20 20
             </Grid.RowDefinitions>
21
+            <Image x:Name="imgCanvas" Visibility="Collapsed"/>
22
+            <InkCanvas Grid.Row="0" x:Name="blackboard_canvas" Background="Transparent" Visibility="Collapsed" Grid.RowSpan="2" />
21 23
             <!--画笔工具栏-->
22 24
             <Grid Grid.Row="0" x:Name="gridToolbar" Visibility="Visible">
23 25
                 <Image Grid.Row="0"  Source="./Images/Toobar22.png" HorizontalAlignment="Right"/>
@@ -49,28 +51,28 @@
49 51
                 </StackPanel>
50 52
             </Grid>
51 53
             <!--字体颜色-->
52
-            <Grid Grid.Row="0" x:Name="gridColour" Visibility="Collapsed">
54
+            <Grid Grid.Row="0" x:Name="gridColour" Visibility="Visible">
53 55
                 <Image Source="./Images/Toobar20.png" HorizontalAlignment="Right" Margin="0,200,62,0"/>
54 56
                 <StackPanel Orientation="Vertical" HorizontalAlignment="Right" Margin="0,215,68,0">
55
-                    <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#FFFFFF" Height="15" Width="15" Margin="0,0,0,0"/>
56
-                    <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#FF0000" Height="15" Width="15" Margin="0,8,0,0"/>
57
-                    <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#A7A9AC" Height="15" Width="15" Margin="0,8,0,0"/>
58
-                    <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#63D600" Height="15" Width="15" Margin="0,8,0,0"/>
59
-                    <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#FFBC00" Height="15" Width="15" Margin="0,8,0,0"/>
60
-                    <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#00B4FC" Height="15" Width="15" Margin="0,8,0,0"/>
57
+                    <Button  Cursor="Hand" x:Name="btnWhite" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#FFFFFF" Height="15" Width="15" Margin="0,0,0,0" Click="BtnWhite_Click"/>
58
+                    <Button  Cursor="Hand" x:Name="btnRed" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#FF0000" Height="15" Width="15" Margin="0,8,0,0" Click="BtnRed_Click"/>
59
+                    <Button  Cursor="Hand" x:Name="btnGray" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#A7A9AC" Height="15" Width="15" Margin="0,8,0,0" Click="BtnGray_Click"/>
60
+                    <Button  Cursor="Hand" x:Name="btnCyanBlue" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#63D600" Height="15" Width="15" Margin="0,8,0,0" Click="BtnCyanBlue_Click"/>
61
+                    <Button  Cursor="Hand" x:Name="btnYellow" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#FFBC00" Height="15" Width="15" Margin="0,8,0,0" Click="BtnYellow_Click"/>
62
+                    <Button  Cursor="Hand" x:Name="btnBlue" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#00B4FC" Height="15" Width="15" Margin="0,8,0,0" Click="BtnBlue_Click"/>
61 63
                 </StackPanel>
62 64
             </Grid>
63 65
             <!--字体粗细-->
64 66
             <Grid Grid.Row="0" x:Name="gridThickness" Visibility="Collapsed">
65 67
                 <Image Grid.Row="0"  Source="./Images/Toobar21.png" HorizontalAlignment="Right" Margin="0,200,62,0"/>
66
-            <StackPanel Grid.Row="0" Orientation="Vertical" HorizontalAlignment="Right" Margin="0,260,62,0">
67
-                <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#FFFFFF" Height="3" Width="20" Margin="0,0,0,0"/>
68
-                <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#FFFFFF" Height="5" Width="20" Margin="0,10,0,0"/>
69
-                <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#FFFFFF" Height="10" Width="20" Margin="0,10,0,0"/>
70
-            </StackPanel>
68
+                <StackPanel Grid.Row="0" Orientation="Vertical" HorizontalAlignment="Right" Margin="0,260,62,0">
69
+                    <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#FFFFFF" Height="3" Width="20" Margin="0,0,0,0"/>
70
+                    <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#FFFFFF" Height="5" Width="20" Margin="0,10,0,0"/>
71
+                    <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#FFFFFF" Height="10" Width="20" Margin="0,10,0,0"/>
72
+                </StackPanel>
71 73
             </Grid>
72
-            
73
-                <Image Grid.Row="1"  Source="./Images/Toobar0.png"/>
74
+
75
+            <Image Grid.Row="1"  Source="./Images/Toobar0.png"/>
74 76
             <TextBlock Grid.Row="1" Text="01:35" FontSize="23" Foreground="#FFFFFF" Margin="30,50,0,0"/>
75 77
             <StackPanel Grid.Row="1" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,0,15,0">
76 78
                 <Button x:Name="BtnRecordingScreen"  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0,0,15,0" Click="BtnRecordingScreen_Click">

+ 112
- 0
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs Parādīt failu

@@ -2,8 +2,11 @@
2 2
 
3 3
 using System;
4 4
 using System.Configuration;
5
+using System.IO;
5 6
 using System.Threading;
6 7
 using System.Windows;
8
+using System.Windows.Ink;
9
+using System.Windows.Media;
7 10
 using System.Windows.Media.Imaging;
8 11
 using XHWK.Model;
9 12
 
@@ -31,6 +34,8 @@ namespace XHWK.WKTool
31 34
         /// 是否暂停
32 35
         /// </summary>
33 36
         bool IsSuspend = true;
37
+        //声明一个 DrawingAttributes 类型的变量  
38
+        DrawingAttributes drawingAttributes;
34 39
         #endregion
35 40
 
36 41
         #region 初始化
@@ -46,6 +51,12 @@ namespace XHWK.WKTool
46 51
         /// </summary>
47 52
         public void Initialize()
48 53
         {
54
+            //创建 DrawingAttributes 类的一个实例  
55
+            drawingAttributes = new DrawingAttributes();
56
+            //将 InkCanvas 的 DefaultDrawingAttributes 属性的值赋成创建的 DrawingAttributes 类的对象的引用  
57
+            //InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型  
58
+            blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
59
+            drawingAttributes.FitToCurve = true;
49 60
             //隐藏画笔工具栏
50 61
             BtnToolbarDown_Click(null, null);
51 62
         }
@@ -189,6 +200,14 @@ namespace XHWK.WKTool
189 200
         /// <param name="e"></param>
190 201
         private void BtnBrush_Click(object sender, RoutedEventArgs e)
191 202
         {
203
+            string time = GetTimeStamp();
204
+            string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
205
+            if (!Directory.Exists(tempPath))
206
+            {
207
+                Directory.CreateDirectory(tempPath);
208
+            }
209
+            string imagePath = Path.Combine(tempPath, time + ".jpg");
210
+            ImageHelper.GetScreenshot(new System.Drawing.Rectangle(0, 0, 0, 0), imagePath);
192 211
             if (gridToolbar.Visibility == Visibility.Visible)
193 212
             {
194 213
                 gridToolbar.Visibility = Visibility.Hidden;
@@ -197,6 +216,44 @@ namespace XHWK.WKTool
197 216
             {
198 217
                 gridToolbar.Visibility = Visibility.Visible;
199 218
             }
219
+            //imgCanvas.Source = new BitmapImage(new Uri(imagePath));
220
+            try
221
+            {
222
+                if (APP.W_PracticeWindow == null)
223
+                {
224
+                    APP.W_PracticeWindow = new PracticeWindow();
225
+                    //APP.W_PracticeWindow.Topmost = true;
226
+                    APP.W_PracticeWindow.Width = pwidth;
227
+                    APP.W_PracticeWindow.Height = pHeight;
228
+                    APP.W_PracticeWindow.Left = 0;
229
+                    APP.W_PracticeWindow.Top = 0;
230
+                    //practiceWin.Owner = this;
231
+                }
232
+                APP.W_PracticeWindow.Initialize(imagePath);
233
+                APP.W_PracticeWindow.ShowDialog();
234
+            }
235
+            catch (Exception ex)
236
+            {
237
+                LogHelper.WriteErrLog("【批注(PracticeWindow)" + ex.Message, ex);
238
+            }
239
+        }
240
+        /// <summary>
241
+        /// 屏幕宽
242
+        /// </summary>
243
+        internal double pwidth = SystemParameters.PrimaryScreenWidth;
244
+
245
+        /// <summary>
246
+        /// 屏幕高
247
+        /// </summary>
248
+        internal double pHeight = SystemParameters.PrimaryScreenHeight;
249
+        /// <summary>
250
+        /// 获取时间戳
251
+        /// </summary>
252
+        /// <returns></returns>
253
+        public string GetTimeStamp()
254
+        {
255
+            TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0);
256
+            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
200 257
         }
201 258
         /// <summary>
202 259
         /// 画笔粗细事件
@@ -219,5 +276,60 @@ namespace XHWK.WKTool
219 276
             gridThickness.Visibility = Visibility.Collapsed;
220 277
         }
221 278
         #endregion
279
+
280
+        /// <summary>
281
+        /// 白色
282
+        /// </summary>
283
+        /// <param name="sender"></param>
284
+        /// <param name="e"></param>
285
+        private void BtnWhite_Click(object sender, RoutedEventArgs e)
286
+        {
287
+            drawingAttributes.Color = Colors.White;
288
+        }
289
+        /// <summary>
290
+        /// 红色
291
+        /// </summary>
292
+        /// <param name="sender"></param>
293
+        /// <param name="e"></param>
294
+        private void BtnRed_Click(object sender, RoutedEventArgs e)
295
+        {
296
+            drawingAttributes.Color = Colors.Red;
297
+        }
298
+        /// <summary>
299
+        /// 黄色
300
+        /// </summary>
301
+        /// <param name="sender"></param>
302
+        /// <param name="e"></param>
303
+        private void BtnYellow_Click(object sender, RoutedEventArgs e)
304
+        {
305
+            drawingAttributes.Color = Colors.Gold;
306
+        }
307
+        /// <summary>
308
+        /// 青色
309
+        /// </summary>
310
+        /// <param name="sender"></param>
311
+        /// <param name="e"></param>
312
+        private void BtnCyanBlue_Click(object sender, RoutedEventArgs e)
313
+        {
314
+            drawingAttributes.Color = Colors.LimeGreen;
315
+        }
316
+        /// <summary>
317
+        /// 灰色
318
+        /// </summary>
319
+        /// <param name="sender"></param>
320
+        /// <param name="e"></param>
321
+        private void BtnGray_Click(object sender, RoutedEventArgs e)
322
+        {
323
+            drawingAttributes.Color = Colors.Gray;
324
+        }
325
+        /// <summary>
326
+        /// 蓝色
327
+        /// </summary>
328
+        /// <param name="sender"></param>
329
+        /// <param name="e"></param>
330
+        private void BtnBlue_Click(object sender, RoutedEventArgs e)
331
+        {
332
+            drawingAttributes.Color = Colors.DeepSkyBlue;
333
+        }
222 334
     }
223 335
 }

+ 26
- 29
XHWK.WKTool/XHMicroLessonSystemWindow.xaml Parādīt failu

@@ -122,35 +122,32 @@
122 122
                 </StackPanel>
123 123
             </Grid>
124 124
             <!--主内容-->
125
-            <Grid Grid.Row="1" x:Name="GridMain"  Margin="20,0,20,0" Background="#FFFFFF" Height="793.700787401575" Width="1142.51968503937" Visibility="Collapsed">
126
-                <Grid.Resources>
127
-                    <TransformGroup x:Key="ImageTransformResource">
128
-                        <ScaleTransform />
129
-                        <TranslateTransform />
130
-                    </TransformGroup>
131
-                </Grid.Resources>
132
-                <Grid.ColumnDefinitions>
133
-                    <ColumnDefinition Width="79*" />
134
-                    <ColumnDefinition Width="1063*"/>
135
-                </Grid.ColumnDefinitions>
136
-                <Rectangle Grid.Column="0" x:Name="MasterImage"
137
-MouseLeftButtonDown="MasterImage_MouseLeftButtonDown"
138
-MouseLeftButtonUp="MasterImage_MouseLeftButtonUp"
139
-MouseMove="MasterImage_MouseMove"
140
-MouseWheel="MasterImage_MouseWheel" Grid.ColumnSpan="2" Margin="0,0,0.4,-0.299">
141
-                    <Rectangle.Fill>
142
-                        <VisualBrush Transform="{StaticResource ImageTransformResource}" Stretch="Uniform">
143
-                            <VisualBrush.Visual>
144
-                                <Image x:Name="imgCanvas" Height="760"/>
145
-                            </VisualBrush.Visual>
146
-                        </VisualBrush>
147
-                    </Rectangle.Fill>
148
-                </Rectangle>
149
-
150
-                <!--<Image Grid.Row="0" x:Name="imgCanvas" Height="760"/>-->
151
-                <InkCanvas Grid.Row="0" x:Name="blackboard_canvas" Background="Transparent" Visibility="Visible" Grid.ColumnSpan="2" Margin="0,0,0.4,-0.299"/>
125
+            <Grid Grid.Row="1" x:Name="GridMain"  Margin="20,0,20,0" Background="#FFFFFF" Height="793.700787401575" Width="1142.51968503937" Visibility="Visible">
126
+                <Grid>
127
+                    <Border Grid.Row="1"  CornerRadius="5">
128
+                        <Grid x:Name="IMG" Margin="0,0,0,0">
129
+                            <Grid.Resources>
130
+                                <TransformGroup x:Key="Imageview">
131
+                                    <ScaleTransform/>
132
+                                    <TranslateTransform/>
133
+                                </TransformGroup>
134
+                            </Grid.Resources>
135
+                            <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled"   Cursor="SizeAll"
136
+                  Margin="0,0,0,0" Focusable="False" x:Name="BackFrame">
137
+                                <ContentControl  MouseLeftButtonDown="IMG1_MouseLeftButtonDown"   
138
+                             MouseLeftButtonUp="IMG1_MouseLeftButtonUp"
139
+                             MouseMove="IMG1_MouseMove"
140
+                             MouseWheel="IMG1_MouseWheel" >
141
+                                    <Image Name="imgCanvas" Width="800" Height="600" MouseDown="PicEMap_MouseDown" RenderTransform="{StaticResource Imageview}"  RenderOptions.BitmapScalingMode="NearestNeighbor">
142
+                                    </Image>
143
+                                </ContentControl>
144
+                            </ScrollViewer>
145
+                        </Grid>
146
+                    </Border>
147
+                </Grid>
148
+                <InkCanvas Grid.Row="0" x:Name="blackboard_canvas" Background="Transparent" Visibility="Collapsed" Grid.ColumnSpan="2" />
152 149
                 <!--摄像头-->
153
-                <wfi:WindowsFormsHost Grid.Row="0" Grid.Column="1" x:Name="wfhCamera" Height="124" Width="172" HorizontalAlignment="Right" Margin="0,10,10.4,0" VerticalAlignment="Top">
150
+                <wfi:WindowsFormsHost Grid.Row="0" Grid.Column="1" x:Name="wfhCamera" Height="124" Width="172" HorizontalAlignment="Right" Margin="0,10,30.10,0" VerticalAlignment="Top">
154 151
                     <aforge:VideoSourcePlayer x:Name="player" Height="124" Width="172"  />
155 152
                 </wfi:WindowsFormsHost>
156 153
                 <StackPanel Grid.Row="0" Orientation="Horizontal" Background="#FFFFFF" Width="240" HorizontalAlignment="Right"
@@ -211,7 +208,7 @@ MouseWheel="MasterImage_MouseWheel" Grid.ColumnSpan="2" Margin="0,0,0.4,-0.299">
211 208
                 </StackPanel>
212 209
             </Grid>
213 210
             <!--设置-->
214
-            <Grid Grid.Row="1" x:Name="gridSetUp" Margin="20,0,20,0" Background="#FFFFFF" Visibility="Visible">
211
+            <Grid Grid.Row="1" x:Name="gridSetUp" Margin="20,0,20,0" Background="#FFFFFF" Visibility="Collapsed">
215 212
                 <Grid.RowDefinitions>
216 213
                     <RowDefinition Height="120"/>
217 214
                     <RowDefinition Height="90"/>

+ 124
- 56
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs Parādīt failu

@@ -53,6 +53,10 @@ namespace XHWK.WKTool
53 53
         private System.Windows.Forms.OpenFileDialog ofd;
54 54
         //声明一个 DrawingAttributes 类型的变量  
55 55
         DrawingAttributes drawingAttributes;
56
+        //定义事件
57
+        public event ChangeTextHandler ChangeTextEvent;
58
+        //定义委托
59
+        public delegate void ChangeTextHandler(string text);
56 60
         #endregion
57 61
 
58 62
         #region 初始化
@@ -167,9 +171,11 @@ namespace XHWK.WKTool
167 171
                 APP.W_ScreenRecordingToolbarWindow.Initialize();
168 172
             }
169 173
             //显示在右下角
170
-            APP.W_ScreenRecordingToolbarWindow.Show();
174
+
171 175
             APP.W_ScreenRecordingToolbarWindow.Left = PrimaryScreen.DESKTOP.Width - APP.W_ScreenRecordingToolbarWindow.Width - 10;
172 176
             APP.W_ScreenRecordingToolbarWindow.Top = PrimaryScreen.DESKTOP.Height - APP.W_ScreenRecordingToolbarWindow.Height - 60;
177
+            APP.W_ScreenRecordingToolbarWindow.Topmost = true;
178
+            APP.W_ScreenRecordingToolbarWindow.Show();
173 179
             Hide();
174 180
         }
175 181
         /// <summary>
@@ -295,12 +301,12 @@ namespace XHWK.WKTool
295 301
         /// <param name="e"></param>
296 302
         private void BtnWhite_Click(object sender, RoutedEventArgs e)
297 303
         {
298
-            //创建 DrawingAttributes 类的一个实例  
299
-            drawingAttributes = new DrawingAttributes();
300
-            //将 InkCanvas 的 DefaultDrawingAttributes 属性的值赋成创建的 DrawingAttributes 类的对象的引用  
301
-            //InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型  
302
-            blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
303
-            //设置 DrawingAttributes 的 Color 属性设置颜色  
304
+            ////创建 DrawingAttributes 类的一个实例  
305
+            //drawingAttributes = new DrawingAttributes();
306
+            ////将 InkCanvas 的 DefaultDrawingAttributes 属性的值赋成创建的 DrawingAttributes 类的对象的引用  
307
+            ////InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型  
308
+            //blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
309
+            ////设置 DrawingAttributes 的 Color 属性设置颜色  
304 310
             drawingAttributes.Color = Colors.White;
305 311
         }
306 312
         /// <summary>
@@ -440,14 +446,39 @@ namespace XHWK.WKTool
440 446
             {
441 447
                 APP.W_JieTuWindow = new JieTuWindow();
442 448
                 // 订阅事件
443
-                //APP.W_JieTuWindow.ChangeTextEvent += new ChangeTextHandler(frm_ChangeTextEvent);
444
-                //APP.W_JieTuWindow.click_closeJietuWindowClick += JietuWindow_click_closeJietuWindowClick;
449
+                APP.W_JieTuWindow.ChangeTextEvent += new ChangeTextHandler(frm_ChangeTextEvent);
450
+                APP.W_JieTuWindow.click_closeJietuWindowClick += JietuWindow_click_closeJietuWindowClick;
445 451
                 APP.W_JieTuWindow.Show();
446 452
             }
447 453
 
448 454
             //imgCanvas.Source = new BitmapImage(new Uri(desktopPath));
449 455
         }
450 456
         /// <summary>
457
+        /// 截图关闭窗口
458
+        /// </summary>
459
+        /// <param name="text"></param>
460
+        private void frm_ChangeTextEvent(string text)
461
+        {
462
+            if ("关闭窗口".Equals(text))
463
+            {
464
+                if(!string.IsNullOrWhiteSpace(APP.ImgPath)&&File.Exists(APP.ImgPath))
465
+                {
466
+                    APP.JPaths[APP.pageData.currpage]= APP.ImgPath;
467
+                    if(!string.IsNullOrWhiteSpace(APP.JPaths[APP.pageData.currpage]))
468
+                    {
469
+                        imgCanvas.Source = new BitmapImage(new Uri(APP.JPaths[APP.pageData.currpage]));
470
+                    }
471
+                }
472
+            }
473
+        }
474
+        /// <summary>
475
+        /// 截图关闭 非正常关闭截图时,截图清空
476
+        /// </summary>
477
+        private void JietuWindow_click_closeJietuWindowClick()
478
+        {
479
+            APP.W_JieTuWindow = null;
480
+        }
481
+        /// <summary>
451 482
         /// 获取时间戳
452 483
         /// </summary>
453 484
         /// <returns></returns>
@@ -584,6 +615,8 @@ namespace XHWK.WKTool
584 615
                 Login();
585 616
                 return;
586 617
             }
618
+
619
+            blackboard_canvas.Visibility = Visibility.Visible;
587 620
             StartRecord();
588 621
         }
589 622
         /// <summary>
@@ -598,6 +631,7 @@ namespace XHWK.WKTool
598 631
                 Login();
599 632
                 return;
600 633
             }
634
+            blackboard_canvas.Visibility = Visibility.Collapsed;
601 635
             EndRecord();
602 636
         }
603 637
         System.Timers.Timer timer;
@@ -857,6 +891,10 @@ namespace XHWK.WKTool
857 891
                         imgCanvas.Source = null;
858 892
                     }
859 893
                 }
894
+                if (!string.IsNullOrWhiteSpace(APP.JPaths[APP.pageData.currpage]))
895
+                {
896
+                    imgCanvas.Source = new BitmapImage(new Uri(APP.JPaths[APP.pageData.currpage]));
897
+                }
860 898
             }
861 899
 
862 900
         }
@@ -883,6 +921,10 @@ namespace XHWK.WKTool
883 921
                         imgCanvas.Source = null;
884 922
                     }
885 923
                 }
924
+                if (!string.IsNullOrWhiteSpace(APP.JPaths[APP.pageData.currpage]))
925
+                {
926
+                    imgCanvas.Source = new BitmapImage(new Uri(APP.JPaths[APP.pageData.currpage]));
927
+                }
886 928
             }
887 929
         }
888 930
         /// <summary>
@@ -895,6 +937,7 @@ namespace XHWK.WKTool
895 937
             APP.pageData.pagenum += 1;
896 938
             APP.pageData.currpage = APP.pageData.pagenum;
897 939
             myblackboard.changepage(APP.pageData.currpage - 1);
940
+            imgCanvas.Source = null;
898 941
         }
899 942
         /// <summary>
900 943
         /// 将Word文档转换为图片的方法(该方法基于第三方DLL),你可以像这样调用该方法: ConvertPDF2Image("F:\\PdfFile.doc", "F:\\",
@@ -977,70 +1020,95 @@ namespace XHWK.WKTool
977 1020
             return sf;
978 1021
         }
979 1022
 
980
-
981
-
982
-
983
-
984
-
985
-        private bool m_IsMouseLeftButtonDown;
986
-
987
-        private void MasterImage_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
1023
+        #region 图像缩放,移动
1024
+        private bool mouseDown;
1025
+        private System.Windows.Point mouseXY;
1026
+        private void IMG1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
988 1027
         {
989
-            Rectangle rectangle = sender as Rectangle;
990
-            if (rectangle == null)
1028
+            var img = sender as ContentControl;
1029
+            if (img == null)
1030
+            {
991 1031
                 return;
1032
+            }
1033
+            img.CaptureMouse();
1034
+            mouseDown = true;
1035
+            mouseXY = e.GetPosition(img);
1036
+            Console.WriteLine("mouseXY.X = " + mouseXY.X + "; mouseXY.Y = " + mouseXY.Y);
992 1037
 
993
-            rectangle.ReleaseMouseCapture();
994
-            m_IsMouseLeftButtonDown = false;
995 1038
         }
996
-
997
-        private Point m_PreviousMousePoint;
998
-        private void MasterImage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
1039
+        private void PicEMap_MouseDown(object sender, MouseButtonEventArgs e)
999 1040
         {
1000
-            Rectangle rectangle = sender as Rectangle;
1001
-            if (rectangle == null)
1041
+            System.Windows.Point point = e.GetPosition(imgCanvas);
1042
+            //Console.WriteLine("PicEmap.X = " + point.X + "; PicEmap.Y = " + point.Y);
1043
+            //if ((point.X - 304) * (point.X - 304) + (point.Y - 86) * (point.Y - 86) < 100) 
1044
+            //{
1045
+            //    Console.WriteLine("在范围内");
1046
+            //}
1047
+        }
1048
+        private void IMG1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
1049
+        {
1050
+            var img = sender as ContentControl;
1051
+            if (img == null)
1052
+            {
1002 1053
                 return;
1003
-
1004
-            rectangle.CaptureMouse();
1005
-            m_IsMouseLeftButtonDown = true;
1006
-            m_PreviousMousePoint = e.GetPosition(rectangle);
1054
+            }
1055
+            img.ReleaseMouseCapture();
1056
+            mouseDown = false;
1007 1057
         }
1008
-
1009
-        private void MasterImage_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
1058
+        private void IMG1_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
1010 1059
         {
1011
-            Rectangle rectangle = sender as Rectangle;
1012
-            if (rectangle == null)
1060
+            var img = sender as ContentControl;
1061
+            if (img == null)
1062
+            {
1013 1063
                 return;
1014
-
1015
-            if (m_IsMouseLeftButtonDown)
1016
-                DoImageMove(rectangle, e);
1064
+            }
1065
+            if (mouseDown)
1066
+            {
1067
+                Domousemove(img, e);
1068
+            }
1017 1069
         }
1018
-
1019
-        private void DoImageMove(Rectangle rectangle, System.Windows.Input.MouseEventArgs e)
1070
+        private void Domousemove(ContentControl img, System.Windows.Input.MouseEventArgs e)
1020 1071
         {
1021
-            //Debug.Assert(e.LeftButton == MouseButtonState.Pressed); 
1022 1072
             if (e.LeftButton != MouseButtonState.Pressed)
1073
+            {
1023 1074
                 return;
1075
+            }
1076
+            var group = IMG.FindResource("Imageview") as TransformGroup;
1077
+            var transform = group.Children[1] as TranslateTransform;
1078
+            var position = e.GetPosition(img);
1079
+            transform.X -= mouseXY.X - position.X;
1080
+            transform.Y -= mouseXY.Y - position.Y;
1081
+            mouseXY = position;
1082
+        }
1083
+        private void IMG1_MouseWheel(object sender, MouseWheelEventArgs e)
1084
+        {
1085
+            var img = sender as ContentControl;
1086
+            if (img == null)
1087
+            {
1088
+                return;
1089
+            }
1090
+            var point = e.GetPosition(img);
1091
+            Console.WriteLine("point.X = " + point.X + "; point.Y=" + point.Y);
1092
+            var PicLocate = e.GetPosition(imgCanvas);
1093
+            Console.WriteLine("PicEmap.X = " + PicLocate.X + "; PicEmap.Y=" + PicLocate.Y);
1024 1094
 
1025
-            TransformGroup group = GridMain.FindResource("ImageTransformResource") as TransformGroup;
1026
-            Debug.Assert(group != null);
1027
-            TranslateTransform transform = group.Children[1] as TranslateTransform;
1028
-            Point position = e.GetPosition(rectangle);
1029
-            transform.X += position.X - m_PreviousMousePoint.X;
1030
-            transform.Y += position.Y - m_PreviousMousePoint.Y;
1031 1095
 
1032
-            m_PreviousMousePoint = position;
1096
+            var group = IMG.FindResource("Imageview") as TransformGroup;
1097
+            var delta = e.Delta * 0.001;
1098
+            DowheelZoom(group, point, delta);
1033 1099
         }
1034
-
1035
-        private void MasterImage_MouseWheel(object sender, MouseWheelEventArgs e)
1100
+        private void DowheelZoom(TransformGroup group, System.Windows.Point point, double delta)
1036 1101
         {
1037
-            TransformGroup group = GridMain.FindResource("ImageTransformResource") as TransformGroup;
1038
-            Debug.Assert(group != null);
1039
-            ScaleTransform transform = group.Children[0] as ScaleTransform;
1040
-            transform.ScaleX += e.Delta * 0.001;
1041
-            transform.ScaleY += e.Delta * 0.001;
1102
+            var pointToContent = group.Inverse.Transform(point);
1103
+            var transform = group.Children[0] as ScaleTransform;
1104
+            if (transform.ScaleX + delta < 0.1) return;
1105
+            transform.ScaleX += delta;
1106
+            transform.ScaleY += delta;
1107
+            var transform1 = group.Children[1] as TranslateTransform;
1108
+            transform1.X = -1 * ((pointToContent.X * transform.ScaleX) - point.X);
1109
+            transform1.Y = -1 * ((pointToContent.Y * transform.ScaleY) - point.Y);
1110
+            //Console.WriteLine("transform.ScaleX = " + transform.ScaleX + "; transform.ScaleY = " + transform.ScaleY);
1042 1111
         }
1043
-
1044
-
1112
+        #endregion
1045 1113
     }
1046 1114
 }

+ 7
- 0
XHWK.WKTool/XHWK.WKTool.csproj Parādīt failu

@@ -118,6 +118,9 @@
118 118
     <Compile Include="Models\EntityBase.cs" />
119 119
     <Compile Include="Models\Limit.cs" />
120 120
     <Compile Include="Models\Tool.cs" />
121
+    <Compile Include="PracticeWindow.xaml.cs">
122
+      <DependentUpon>PracticeWindow.xaml</DependentUpon>
123
+    </Compile>
121 124
     <Compile Include="ScreenRecordingToolbarWindow.xaml.cs">
122 125
       <DependentUpon>ScreenRecordingToolbarWindow.xaml</DependentUpon>
123 126
     </Compile>
@@ -144,6 +147,10 @@
144 147
       <SubType>Designer</SubType>
145 148
       <Generator>MSBuild:Compile</Generator>
146 149
     </Page>
150
+    <Page Include="PracticeWindow.xaml">
151
+      <SubType>Designer</SubType>
152
+      <Generator>MSBuild:Compile</Generator>
153
+    </Page>
147 154
     <Page Include="Themes\Generic.xaml">
148 155
       <Generator>MSBuild:Compile</Generator>
149 156
       <SubType>Designer</SubType>

Notiek ielāde…
Atcelt
Saglabāt