소스 검색

zhao:解决冲突

tags/录制修改前
耀 4 년 전
부모
커밋
15423a8b20

+ 4
- 0
Common/Common.csproj 파일 보기

@@ -71,6 +71,9 @@
71 71
     <Reference Include="NPOI.OpenXmlFormats">
72 72
       <HintPath>dlls\NPOI.OpenXmlFormats.dll</HintPath>
73 73
     </Reference>
74
+    <Reference Include="O2S.Components.PDFRender4NET">
75
+      <HintPath>..\dl\O2S.Components.PDFRender4NET.dll</HintPath>
76
+    </Reference>
74 77
     <Reference Include="PresentationCore" />
75 78
     <Reference Include="PresentationFramework" />
76 79
     <Reference Include="System" />
@@ -114,6 +117,7 @@
114 117
   </ItemGroup>
115 118
   <ItemGroup>
116 119
     <Compile Include="Model\DownloadInfoModel.cs" />
120
+    <Compile Include="system\PdfTrunImage.cs" />
117 121
     <Compile Include="system\BlackboardNew.cs" />
118 122
     <Compile Include="system\CameraHelper.cs" />
119 123
     <Compile Include="system\CLeopardZip.cs" />

+ 3
- 0
Common/system/ImageHelper.cs 파일 보기

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

+ 87
- 0
Common/system/PdfTrunImage.cs 파일 보기

@@ -0,0 +1,87 @@
1
+using System.Collections.Generic;
2
+using System.Drawing;
3
+using System.Drawing.Imaging;
4
+using System.IO;
5
+using O2S.Components.PDFRender4NET;
6
+
7
+namespace Common.system
8
+{
9
+    /// <summary>
10
+    /// 
11
+    /// Class to convert a pdf to an image using GhostScript DLL
12
+    /// Credit for this code go to:Rangel Avulso
13
+    /// i only fix a little bug and refactor a little
14
+    /// http://www.hrangel.com.br/index.php/2006/12/04/converter-pdf-para-imagem-jpeg-em-c/
15
+    /// </summary>
16
+    /// <seealso cref="http://www.hrangel.com.br/index.php/2006/12/04/converter-pdf-para-imagem-jpeg-em-c/"/>
17
+   public class PdfTrunImage
18
+    {
19
+        public enum Definition
20
+        {
21
+            One = 1, Two = 2, Three = 3, Four = 4, Five = 5, Six = 6, Seven = 7, Eight = 8, Nine = 9, Ten = 10
22
+        }
23
+
24
+        /// <summary>
25
+        /// 将PDF文档转换为图片的方法
26
+        /// </summary>
27
+        /// <param name="pdfInputPath">PDF文件路径</param>
28
+        /// <param name="imageOutputPath">图片输出路径</param>
29
+        /// <param name="imageName">生成图片的名字</param>
30
+        /// <param name="startPageNum">从PDF文档的第几页开始转换</param>
31
+        /// <param name="endPageNum">从PDF文档的第几页开始停止转换</param>
32
+        /// <param name="imageFormat">设置所需图片格式</param>
33
+        /// <param name="definition">设置图片的清晰度,数字越大越清晰</param>
34
+        public static List<string> ConvertPDF2Image(string pdfInputPath, string imageOutputPath,
35
+            string imageName, int startPageNum, int endPageNum, ImageFormat imageFormat, Definition definition)
36
+        {
37
+            List<string> images = new List<string>();
38
+            try
39
+            {
40
+                PDFFile pdfFile = PDFFile.Open(pdfInputPath);
41
+
42
+                if (!Directory.Exists(imageOutputPath))
43
+                {
44
+                    Directory.CreateDirectory(imageOutputPath);
45
+                }
46
+
47
+                // validate pageNum
48
+                if (startPageNum <= 0)
49
+                {
50
+                    startPageNum = 1;
51
+                }
52
+
53
+                if (endPageNum==0||endPageNum > pdfFile.PageCount)
54
+                {
55
+                    endPageNum = pdfFile.PageCount;
56
+                }
57
+                if (startPageNum > endPageNum)
58
+                {
59
+                    int tempPageNum = startPageNum;
60
+                    startPageNum = endPageNum;
61
+                    endPageNum = startPageNum;
62
+                }
63
+
64
+                // start to convert each page
65
+                for (int i = startPageNum; i <= endPageNum; i++)
66
+                {
67
+                    Bitmap pageImage = pdfFile.GetPageImage(i - 1, 56 * (int)definition);
68
+                    string imgPath = imageOutputPath + imageName + i.ToString() + "." + imageFormat.ToString();
69
+                    pageImage.Save(imgPath, imageFormat);
70
+                    images.Add(imgPath);
71
+                    // 返回的图片绝对路径集合
72
+                    pageImage.Dispose();
73
+                }
74
+
75
+                pdfFile.Dispose();
76
+                return images;
77
+            }
78
+            catch (System.Exception ex)
79
+            {
80
+                LogHelper.WriteErrLog("PDF转图片" +
81
+                    "【PdfTrunImage】" + ex.Message, ex);
82
+                images = new List<string>();
83
+                return images;
84
+            }
85
+        }
86
+    }
87
+}

+ 23
- 0
XHWK.Model/Model_Screenshot.cs 파일 보기

@@ -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 파일 보기

@@ -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" />

+ 10
- 1
XHWK.WKTool/App.cs 파일 보기

@@ -57,6 +57,10 @@ namespace XHWK.WKTool
57 57
         /// </summary>
58 58
         public static JieTuWindow W_JieTuWindow = null;
59 59
         /// <summary>
60
+        /// 批注
61
+        /// </summary>
62
+        public static PracticeWindow W_PracticeWindow = null;
63
+        /// <summary>
60 64
         /// 登陆状态 false 未登录 true已登陆
61 65
         /// </summary>
62 66
         public static bool IsLoginType = false;
@@ -66,9 +70,14 @@ namespace XHWK.WKTool
66 70
         /// </summary>
67 71
         public static long num = 9999;
68 72
         /// <summary>
69
-        /// 图片路径
73
+        /// 导入图片路径
70 74
         /// </summary>
71 75
         public static string[] Paths = new string[] { };
76
+        /// <summary>
77
+        /// 截图图片路径
78
+        /// </summary>
79
+        public static string[] JPaths = new string[999];
80
+        public static string ImgPath = string.Empty;
72 81
         #endregion
73 82
 
74 83
         [STAThread]

+ 5
- 0
XHWK.WKTool/CountdownWindow.xaml.cs 파일 보기

@@ -47,6 +47,11 @@ namespace XHWK.WKTool
47 47
                     Hide();
48 48
                 });
49 49
             }
50
+            //_state = State.End;
51
+            Dispatcher.Invoke(
52
+                DispatcherPriority.Normal,
53
+                new Action(() => { this.Hide(); imgLoding.Source = new BitmapImage(new Uri("pack://application:,,/Images/countdown_3.png")); })
54
+                );
50 55
         }
51 56
         /// <summary>
52 57
         /// 加载图片

+ 12
- 8
XHWK.WKTool/JieTuWindow.xaml.cs 파일 보기

@@ -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 파일 보기

@@ -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>

+ 155
- 0
XHWK.WKTool/PracticeWindow.xaml.cs 파일 보기

@@ -0,0 +1,155 @@
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.Ink;
12
+using System.Windows.Input;
13
+using System.Windows.Media;
14
+using System.Windows.Media.Imaging;
15
+using System.Windows.Shapes;
16
+
17
+namespace XHWK.WKTool
18
+{
19
+    /// <summary>
20
+    /// 录屏画板
21
+    /// </summary>
22
+    public partial class PracticeWindow : Window
23
+    {
24
+        //声明一个 DrawingAttributes 类型的变量  
25
+        DrawingAttributes drawingAttributes;
26
+        public PracticeWindow()
27
+        {
28
+            InitializeComponent();
29
+        }
30
+        public void Initialize(string _imgPath)
31
+        {
32
+            blackboard_canvas.Strokes.Clear();
33
+            blackboard_canvas.UseCustomCursor = true;
34
+            //blackboard_canvas.EditingMode = InkCanvasEditingMode.EraseByStroke;
35
+            if (File.Exists(_imgPath))
36
+            {
37
+                imgCanvas.Source = new BitmapImage(new Uri(_imgPath));
38
+            }
39
+            //创建 DrawingAttributes 类的一个实例  
40
+            drawingAttributes = new DrawingAttributes();
41
+            //将 InkCanvas 的 DefaultDrawingAttributes 属性的值赋成创建的 DrawingAttributes 类的对象的引用  
42
+            //InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型  
43
+            blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
44
+            Pen();
45
+            blackboard_canvas.Cursor = Cursors.Pen;
46
+            //Cursor cus = new Cursor(@"G:\Icon.ico");
47
+            
48
+            //blackboard_canvas.Cursor = cus;
49
+        }
50
+
51
+
52
+
53
+        /// <summary>
54
+        /// 画笔颜色事件 白色
55
+        /// </summary>
56
+        /// <param name="sender"></param>
57
+        /// <param name="e"></param>
58
+        public void White()
59
+        {
60
+            drawingAttributes.Color = Colors.White;
61
+        }
62
+        /// <summary>
63
+        /// 画笔颜色事件 红色
64
+        /// </summary>
65
+        /// <param name="sender"></param>
66
+        /// <param name="e"></param>
67
+        public void Red()
68
+        {
69
+
70
+            //设置 DrawingAttributes 的 Color 属性设置颜色  
71
+            drawingAttributes.Color = Colors.Red;
72
+        }
73
+        /// <summary>
74
+        /// 画笔颜色事件 灰色
75
+        /// </summary>
76
+        /// <param name="sender"></param>
77
+        /// <param name="e"></param>
78
+        public void Gray()
79
+        {
80
+            drawingAttributes.Color = Colors.Gray;
81
+        }
82
+        /// <summary>
83
+        /// 画笔颜色事件 青色
84
+        /// </summary>
85
+        /// <param name="sender"></param>
86
+        /// <param name="e"></param>
87
+        public void CyanBlue()
88
+        {
89
+            drawingAttributes.Color = Colors.LimeGreen;
90
+        }
91
+        /// <summary>
92
+        /// 画笔颜色事件 黄色
93
+        /// </summary>
94
+        /// <param name="sender"></param>
95
+        /// <param name="e"></param>
96
+        public void Yellow()
97
+        {
98
+            drawingAttributes.Color = Colors.Gold;
99
+        }
100
+        /// <summary>
101
+        /// 画笔颜色事件 蓝色
102
+        /// </summary>
103
+        /// <param name="sender"></param>
104
+        /// <param name="e"></param>
105
+        public void Blue()
106
+        {
107
+            drawingAttributes.Color = Colors.DeepSkyBlue;
108
+        }
109
+        /// <summary>
110
+        /// 画笔粗细事件 细
111
+        /// </summary>
112
+        /// <param name="sender"></param>
113
+        /// <param name="e"></param>
114
+        public void Fine()
115
+        {
116
+            drawingAttributes.Width = 1;
117
+            drawingAttributes.Height = 1;
118
+        }
119
+        /// <summary>
120
+        /// 画笔粗细事件 中
121
+        /// </summary>
122
+        /// <param name="sender"></param>
123
+        /// <param name="e"></param>
124
+        public void In()
125
+        {
126
+            drawingAttributes.Width = 3;
127
+            drawingAttributes.Height = 3;
128
+        }
129
+        /// <summary>
130
+        /// 画笔粗细事件 粗
131
+        /// </summary>
132
+        /// <param name="sender"></param>
133
+        /// <param name="e"></param>
134
+        public void Crude()
135
+        {
136
+            drawingAttributes.Width = 5;
137
+            drawingAttributes.Height = 5;
138
+        }
139
+        public void Eraser() 
140
+        {
141
+            //this.type = ZPenType.Erase;
142
+            blackboard_canvas.UseCustomCursor = false;
143
+            blackboard_canvas.EditingMode = InkCanvasEditingMode.EraseByPoint;
144
+            blackboard_canvas.EraserShape = new EllipseStylusShape(64, 64, 0);
145
+        }
146
+        public void Pen()
147
+        {
148
+            blackboard_canvas.EditingMode = InkCanvasEditingMode.Ink;
149
+            blackboard_canvas.UseCustomCursor = true;
150
+            drawingAttributes.FitToCurve = true;
151
+            drawingAttributes.IgnorePressure = false;
152
+            blackboard_canvas.Cursor = Cursors.Pen;
153
+        }
154
+    }
155
+}

+ 18
- 16
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml 파일 보기

@@ -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"/>
@@ -28,13 +30,13 @@
28 30
                     <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0,5,0,0">
29 31
                         <Image Source="./Images/Toobar12.png"/>
30 32
                     </Button>
31
-                    <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0,5,0,0">
33
+                    <Button  Cursor="Hand" x:Name="btnPen" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0,5,0,0" Click="BtnPen_Click">
32 34
                         <Image Source="./Images/Toobar9.png"/>
33 35
                     </Button>
34 36
                     <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0,5,0,0">
35 37
                         <Image Source="./Images/Toobar16.png"/>
36 38
                     </Button>
37
-                    <Button  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0,5,0,0">
39
+                    <Button  Cursor="Hand" x:Name="btnEraser" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0,5,0,0" Click="BtnEraser_Click">
38 40
                         <Image Source="./Images/Toobar3.png"/>
39 41
                     </Button>
40 42
                     <Button  Cursor="Hand" x:Name="btnColour" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="0,5,0,0" Click="BtnColour_Click">
@@ -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" x:Name="btnFine" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#FFFFFF" Height="3" Width="20" Margin="0,0,0,0" Click="BtnFine_Click"/>
70
+                    <Button  Cursor="Hand" x:Name="btnIn" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#FFFFFF" Height="5" Width="20" Margin="0,10,0,0" Click="BtnIn_Click"/>
71
+                    <Button  Cursor="Hand" x:Name="btnCrude" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#FFFFFF" Height="10" Width="20" Margin="0,10,0,0" Click="BtnCrude_Click"/>
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">

+ 170
- 2
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs 파일 보기

@@ -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
 
@@ -35,6 +38,8 @@ namespace XHWK.WKTool
35 38
         /// 视频信息
36 39
         /// </summary>
37 40
         Model_Video VideoInfo = null;
41
+        //声明一个 DrawingAttributes 类型的变量  
42
+        DrawingAttributes drawingAttributes;
38 43
         #endregion
39 44
 
40 45
         #region 初始化
@@ -50,11 +55,21 @@ namespace XHWK.WKTool
50 55
         /// </summary>
51 56
         public void Initialize()
52 57
         {
58
+            //创建 DrawingAttributes 类的一个实例  
59
+            drawingAttributes = new DrawingAttributes();
60
+            //将 InkCanvas 的 DefaultDrawingAttributes 属性的值赋成创建的 DrawingAttributes 类的对象的引用  
61
+            //InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型  
62
+            blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
63
+            drawingAttributes.FitToCurve = true;
53 64
             //隐藏画笔工具栏
54
-            BtnToolbarDown_Click(null, null);
65
+            //BtnToolbarDown_Click(null, null);
66
+            gridToolbar.Visibility = Visibility.Hidden;
67
+            gridColour.Visibility = Visibility.Hidden;
68
+            gridThickness.Visibility = Visibility.Hidden;
55 69
         }
56 70
         #endregion
57 71
 
72
+        #region 事件
58 73
         #region 录制
59 74
         /// <summary>
60 75
         /// 开始或暂停录制
@@ -65,7 +80,7 @@ namespace XHWK.WKTool
65 80
         {
66 81
             if (IsSuspend)
67 82
             {
68
-                if(IsFirstRS)
83
+                if (IsFirstRS)
69 84
                 {
70 85
                     VideoInfo = new Model_Video();
71 86
                     VideoInfo.VideoType = (Enum_VideoType)int.Parse(FileToolsCommon.GetConfigValue("VideoType"));
@@ -201,6 +216,7 @@ namespace XHWK.WKTool
201 216
             gridToolbar.Visibility = Visibility.Hidden;
202 217
             gridColour.Visibility = Visibility.Hidden;
203 218
             gridThickness.Visibility = Visibility.Hidden;
219
+            APP.W_PracticeWindow.Hide();
204 220
         }
205 221
         /// <summary>
206 222
         /// 画笔点击事件
@@ -209,6 +225,14 @@ namespace XHWK.WKTool
209 225
         /// <param name="e"></param>
210 226
         private void BtnBrush_Click(object sender, RoutedEventArgs e)
211 227
         {
228
+            string time = GetTimeStamp();
229
+            string tempPath = AppDomain.CurrentDomain.BaseDirectory + "temp\\";
230
+            if (!Directory.Exists(tempPath))
231
+            {
232
+                Directory.CreateDirectory(tempPath);
233
+            }
234
+            string imagePath = Path.Combine(tempPath, time + ".jpg");
235
+            ImageHelper.GetScreenshot(new System.Drawing.Rectangle(0, 0, 0, 0), imagePath);
212 236
             if (gridToolbar.Visibility == Visibility.Visible)
213 237
             {
214 238
                 gridToolbar.Visibility = Visibility.Hidden;
@@ -217,6 +241,43 @@ namespace XHWK.WKTool
217 241
             {
218 242
                 gridToolbar.Visibility = Visibility.Visible;
219 243
             }
244
+            //imgCanvas.Source = new BitmapImage(new Uri(imagePath));
245
+            try
246
+            {
247
+                if (APP.W_PracticeWindow == null)
248
+                {
249
+                    APP.W_PracticeWindow = new PracticeWindow();
250
+                    //APP.W_PracticeWindow.Topmost = true;
251
+                    APP.W_PracticeWindow.Width = pwidth;
252
+                    APP.W_PracticeWindow.Height = pHeight;
253
+                    APP.W_PracticeWindow.Left = 0;
254
+                    APP.W_PracticeWindow.Top = 0;
255
+                    //practiceWin.Owner = this;
256
+                }
257
+                APP.W_PracticeWindow.Initialize(imagePath);
258
+                APP.W_PracticeWindow.Show();
259
+            }
260
+            catch (Exception ex)
261
+            {
262
+                LogHelper.WriteErrLog("【批注(PracticeWindow)" + ex.Message, ex);
263
+            }
264
+        }
265
+        /// <summary>
266
+        /// 屏幕宽
267
+        /// </summary>
268
+        internal double pwidth = SystemParameters.PrimaryScreenWidth;
269
+        /// <summary>
270
+        /// 屏幕高
271
+        /// </summary>
272
+        internal double pHeight = SystemParameters.PrimaryScreenHeight;
273
+        /// <summary>
274
+        /// 获取时间戳
275
+        /// </summary>
276
+        /// <returns></returns>
277
+        public string GetTimeStamp()
278
+        {
279
+            TimeSpan ts = DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0);
280
+            return Convert.ToInt64(ts.TotalMilliseconds).ToString();
220 281
         }
221 282
         /// <summary>
222 283
         /// 画笔粗细事件
@@ -238,6 +299,113 @@ namespace XHWK.WKTool
238 299
             gridColour.Visibility = Visibility.Visible;
239 300
             gridThickness.Visibility = Visibility.Collapsed;
240 301
         }
302
+        /// <summary>
303
+        /// 白色
304
+        /// </summary>
305
+        /// <param name="sender"></param>
306
+        /// <param name="e"></param>
307
+        private void BtnWhite_Click(object sender, RoutedEventArgs e)
308
+        {
309
+            //drawingAttributes.Color = Colors.White;
310
+            APP.W_PracticeWindow.White();
311
+        }
312
+        /// <summary>
313
+        /// 红色
314
+        /// </summary>
315
+        /// <param name="sender"></param>
316
+        /// <param name="e"></param>
317
+        private void BtnRed_Click(object sender, RoutedEventArgs e)
318
+        {
319
+            //drawingAttributes.Color = Colors.Red;
320
+            APP.W_PracticeWindow.Red();
321
+        }
322
+        /// <summary>
323
+        /// 黄色
324
+        /// </summary>
325
+        /// <param name="sender"></param>
326
+        /// <param name="e"></param>
327
+        private void BtnYellow_Click(object sender, RoutedEventArgs e)
328
+        {
329
+            //drawingAttributes.Color = Colors.Gold;
330
+            APP.W_PracticeWindow.Yellow();
331
+        }
332
+        /// <summary>
333
+        /// 青色
334
+        /// </summary>
335
+        /// <param name="sender"></param>
336
+        /// <param name="e"></param>
337
+        private void BtnCyanBlue_Click(object sender, RoutedEventArgs e)
338
+        {
339
+            //drawingAttributes.Color = Colors.LimeGreen;
340
+            APP.W_PracticeWindow.CyanBlue();
341
+        }
342
+        /// <summary>
343
+        /// 灰色
344
+        /// </summary>
345
+        /// <param name="sender"></param>
346
+        /// <param name="e"></param>
347
+        private void BtnGray_Click(object sender, RoutedEventArgs e)
348
+        {
349
+            //drawingAttributes.Color = Colors.Gray;
350
+            APP.W_PracticeWindow.Gray();
351
+        }
352
+        /// <summary>
353
+        /// 蓝色
354
+        /// </summary>
355
+        /// <param name="sender"></param>
356
+        /// <param name="e"></param>
357
+        private void BtnBlue_Click(object sender, RoutedEventArgs e)
358
+        {
359
+            //drawingAttributes.Color = Colors.DeepSkyBlue;
360
+            APP.W_PracticeWindow.Blue();
361
+        }
362
+        /// <summary>
363
+        /// 画笔 细
364
+        /// </summary>
365
+        /// <param name="sender"></param>
366
+        /// <param name="e"></param>
367
+        private void BtnFine_Click(object sender, RoutedEventArgs e)
368
+        {
369
+            APP.W_PracticeWindow.Fine();
370
+        }
371
+        /// <summary>
372
+        /// 画笔 中
373
+        /// </summary>
374
+        /// <param name="sender"></param>
375
+        /// <param name="e"></param>
376
+        private void BtnIn_Click(object sender, RoutedEventArgs e)
377
+        {
378
+            APP.W_PracticeWindow.In();
379
+        }
380
+        /// <summary>
381
+        /// 画笔粗
382
+        /// </summary>
383
+        /// <param name="sender"></param>
384
+        /// <param name="e"></param>
385
+        private void BtnCrude_Click(object sender, RoutedEventArgs e)
386
+        {
387
+            APP.W_PracticeWindow.Crude();
388
+        }
389
+        /// <summary>
390
+        /// 橡皮
391
+        /// </summary>
392
+        /// <param name="sender"></param>
393
+        /// <param name="e"></param>
394
+        private void BtnEraser_Click(object sender, RoutedEventArgs e)
395
+        {
396
+            APP.W_PracticeWindow.Eraser();
397
+        }
241 398
         #endregion
399
+
400
+        #endregion
401
+        /// <summary>
402
+        /// 🖊
403
+        /// </summary>
404
+        /// <param name="sender"></param>
405
+        /// <param name="e"></param>
406
+        private void BtnPen_Click(object sender, RoutedEventArgs e)
407
+        {
408
+            APP.W_PracticeWindow.Pen();
409
+        }
242 410
     }
243 411
 }

+ 27
- 46
XHWK.WKTool/XHMicroLessonSystemWindow.xaml 파일 보기

@@ -123,44 +123,37 @@
123 123
             </Grid>
124 124
             <!--主内容-->
125 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.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
-
137
-                <Label Content="" Grid.Column="0" HorizontalAlignment="Left" Height="1" VerticalAlignment="Top" Width="1" Background="#FF0F0F0F" Margin="1,0,0,0"/>
138
-                <Rectangle Grid.Column="0" x:Name="MasterImage"
139
-MouseLeftButtonDown="MasterImage_MouseLeftButtonDown"
140
-MouseLeftButtonUp="MasterImage_MouseLeftButtonUp"
141
-MouseMove="MasterImage_MouseMove"
142
-MouseWheel="MasterImage_MouseWheel" Grid.ColumnSpan="2" Margin="0,0,0.4,-0.299">
143
-                    <Rectangle.Fill>
144
-                        <VisualBrush Transform="{StaticResource ImageTransformResource}" Stretch="Uniform">
145
-                            <VisualBrush.Visual>
146
-                                <Image x:Name="imgCanvas" Height="760"/>
147
-                            </VisualBrush.Visual>
148
-                        </VisualBrush>
149
-                    </Rectangle.Fill>
150
-                </Rectangle>
151
-
152
-                <!--<Image Grid.Row="0" x:Name="imgCanvas" Height="760"/>-->
153
-                <InkCanvas Grid.Row="0" x:Name="blackboard_canvas" Background="Transparent" Visibility="Visible" Grid.ColumnSpan="2">
154
-
155
-                </InkCanvas>
156
-
157 126
                 <Label Content="" Grid.Column="0" Height="1" Width="1" Background="#FF0F0F0F" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="1,0,0,0"/>
127
+                <Grid>
128
+                    <Border Grid.Row="1"  CornerRadius="5">
129
+                        <Grid x:Name="IMG" Margin="0,0,0,0">
130
+                            <Grid.Resources>
131
+                                <TransformGroup x:Key="Imageview">
132
+                                    <ScaleTransform/>
133
+                                    <TranslateTransform/>
134
+                                </TransformGroup>
135
+                                </Grid.Resources>
136
+                                <Label Content="" Grid.Column="0" HorizontalAlignment="Left" Height="1" VerticalAlignment="Top" Width="1" Background="#FF0F0F0F" Margin="1,0,0,0"/>
137
+                                <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled"   Cursor="SizeAll"
138
+                  Margin="0,0,0,0" Focusable="False" x:Name="BackFrame">
139
+                                <ContentControl  MouseLeftButtonDown="IMG1_MouseLeftButtonDown"   
140
+                             MouseLeftButtonUp="IMG1_MouseLeftButtonUp"
141
+                             MouseMove="IMG1_MouseMove"
142
+                             MouseWheel="IMG1_MouseWheel" >
143
+                                    <Image Name="imgCanvas" Width="800" Height="600" MouseDown="PicEMap_MouseDown" RenderTransform="{StaticResource Imageview}"  RenderOptions.BitmapScalingMode="NearestNeighbor">
144
+                                    </Image>
145
+                                </ContentControl>
146
+                            </ScrollViewer>
147
+                        </Grid>
148
+                    </Border>
149
+                </Grid>
150
+                <InkCanvas Grid.Row="0" x:Name="blackboard_canvas" Background="Transparent" Visibility="Collapsed" Grid.ColumnSpan="2" />
158 151
                 <!--摄像头-->
159
-                <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">
152
+                <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">
160 153
                     <aforge:VideoSourcePlayer x:Name="player" Height="124" Width="172"  />
161 154
                 </wfi:WindowsFormsHost>
162
-                <StackPanel Grid.Row="0" Orientation="Horizontal" Background="#FFFFFF" Width="240" HorizontalAlignment="Right"
163
-            Height="58" Margin="0,718,50.4,17.701" Grid.Column="1">
155
+                <StackPanel Grid.Row="0" Orientation="Horizontal" Background="#FFFFFF" Width="180" HorizontalAlignment="Right"
156
+            Height="58" Margin="0,718,50,0" Grid.Column="1">
164 157
                     <Button Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
165 158
                     x:Name="last_button"
166 159
                     Width="60"
@@ -202,18 +195,6 @@ MouseWheel="MasterImage_MouseWheel" Grid.ColumnSpan="2" Margin="0,0,0.4,-0.299">
202 195
                             </StackPanel>
203 196
                         </Button.Content>
204 197
                     </Button>
205
-
206
-                    <Button Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
207
-                    x:Name="add_button"
208
-                    Width="60"
209
-                    Click="add_button_Click">
210
-                        <Button.Content>
211
-                            <StackPanel>
212
-                                <Image Width="16" Source=".\Images\class_p3.png" />
213
-                                <TextBlock Margin="0,4,0,0" Text="添加" />
214
-                            </StackPanel>
215
-                        </Button.Content>
216
-                    </Button>
217 198
                 </StackPanel>
218 199
 
219 200
                 <Label Content="" Grid.Column="1" Height="1" Width="1" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,21,0"/>

+ 223
- 102
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs 파일 보기

@@ -1,8 +1,6 @@
1 1
 using Aspose.Words;
2 2
 using Aspose.Words.Saving;
3
-
4 3
 using Common.system;
5
-
6 4
 using System;
7 5
 using System.Collections.Generic;
8 6
 using System.Drawing.Imaging;
@@ -14,25 +12,11 @@ using System.Windows.Ink;
14 12
 using System.Windows.Input;
15 13
 using System.Windows.Media;
16 14
 using System.Windows.Media.Imaging;
17
-
18 15
 using XHWK.Model;
19
-
20
-
21
-using System;
22
-using System.Collections.Generic;
23
-
24
-using System.Text;
25
-using System.Windows;
26 16
 using System.Windows.Controls;
27
-using System.Windows.Data;
28
-using System.Windows.Documents;
29
-using System.Windows.Input;
30
-using System.Windows.Media;
31
-using System.Windows.Media.Imaging;
32
-using System.Windows.Navigation;
33
-using System.Windows.Shapes;
34
-using System.Diagnostics;
35 17
 using ComeCapture;
18
+using Aspose.Slides;
19
+using static Common.system.PdfTrunImage;
36 20
 
37 21
 namespace XHWK.WKTool
38 22
 {
@@ -41,7 +25,7 @@ namespace XHWK.WKTool
41 25
     /// </summary>
42 26
     public partial class XHMicroLessonSystemWindow : Window
43 27
     {
44
-        #region 初始值
28
+        #region 字段
45 29
         /// <summary>
46 30
         /// 文件目录窗口
47 31
         /// </summary>
@@ -53,8 +37,11 @@ namespace XHWK.WKTool
53 37
         private System.Windows.Forms.OpenFileDialog ofd;
54 38
         //声明一个 DrawingAttributes 类型的变量  
55 39
         DrawingAttributes drawingAttributes;
56
-
57 40
         Model_Video VideoInfo = null;
41
+        //定义事件
42
+        public event ChangeTextHandler ChangeTextEvent;
43
+        //定义委托
44
+        public delegate void ChangeTextHandler(string text);
58 45
         #endregion
59 46
 
60 47
         #region 初始化
@@ -63,7 +50,9 @@ namespace XHWK.WKTool
63 50
         /// </summary>
64 51
         public XHMicroLessonSystemWindow()
65 52
         {
53
+            new Aspose.Pdf.License().SetLicense(new MemoryStream(Convert.FromBase64String("PExpY2Vuc2U+CiAgPERhdGE+CiAgICA8TGljZW5zZWRUbz5TdXpob3UgQXVuYm94IFNvZnR3YXJlIENvLiwgTHRkLjwvTGljZW5zZWRUbz4KICAgIDxFbWFpbFRvPnNhbGVzQGF1bnRlYy5jb208L0VtYWlsVG8+CiAgICA8TGljZW5zZVR5cGU+RGV2ZWxvcGVyIE9FTTwvTGljZW5zZVR5cGU+CiAgICA8TGljZW5zZU5vdGU+TGltaXRlZCB0byAxIGRldmVsb3BlciwgdW5saW1pdGVkIHBoeXNpY2FsIGxvY2F0aW9uczwvTGljZW5zZU5vdGU+CiAgICA8T3JkZXJJRD4xOTA4MjYwODA3NTM8L09yZGVySUQ+CiAgICA8VXNlcklEPjEzNDk3NjAwNjwvVXNlcklEPgogICAgPE9FTT5UaGlzIGlzIGEgcmVkaXN0cmlidXRhYmxlIGxpY2Vuc2U8L09FTT4KICAgIDxQcm9kdWN0cz4KICAgICAgPFByb2R1Y3Q+QXNwb3NlLlRvdGFsIGZvciAuTkVUPC9Qcm9kdWN0PgogICAgPC9Qcm9kdWN0cz4KICAgIDxFZGl0aW9uVHlwZT5FbnRlcnByaXNlPC9FZGl0aW9uVHlwZT4KICAgIDxTZXJpYWxOdW1iZXI+M2U0NGRlMzAtZmNkMi00MTA2LWIzNWQtNDZjNmEzNzE1ZmMyPC9TZXJpYWxOdW1iZXI+CiAgICA8U3Vic2NyaXB0aW9uRXhwaXJ5PjIwMjAwODI3PC9TdWJzY3JpcHRpb25FeHBpcnk+CiAgICA8TGljZW5zZVZlcnNpb24+My4wPC9MaWNlbnNlVmVyc2lvbj4KICAgIDxMaWNlbnNlSW5zdHJ1Y3Rpb25zPmh0dHBzOi8vcHVyY2hhc2UuYXNwb3NlLmNvbS9wb2xpY2llcy91c2UtbGljZW5zZTwvTGljZW5zZUluc3RydWN0aW9ucz4KICA8L0RhdGE+CiAgPFNpZ25hdHVyZT53UGJtNUt3ZTYvRFZXWFNIY1o4d2FiVEFQQXlSR0pEOGI3L00zVkV4YWZpQnd5U2h3YWtrNGI5N2c2eGtnTjhtbUFGY3J0c0cwd1ZDcnp6MytVYk9iQjRYUndTZWxsTFdXeXNDL0haTDNpN01SMC9jZUFxaVZFOU0rWndOQkR4RnlRbE9uYTFQajhQMzhzR1grQ3ZsemJLZFZPZXk1S3A2dDN5c0dqYWtaL1E9PC9TaWduYXR1cmU+CjwvTGljZW5zZT4=")));
66 54
             InitializeComponent();
55
+
67 56
             myblackboard = new BlackboardNew(blackboard_canvas);
68 57
             APP.pageData.pagenum = 1;
69 58
             APP.pageData.currpage = 1;
@@ -92,11 +81,11 @@ namespace XHWK.WKTool
92 81
             //将 InkCanvas 的 DefaultDrawingAttributes 属性的值赋成创建的 DrawingAttributes 类的对象的引用  
93 82
             //InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型  
94 83
             blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
84
+            blackboard_canvas.UseCustomCursor = true;
95 85
             drawingAttributes.FitToCurve = true;
96
-
86
+            drawingAttributes.IgnorePressure = false;
87
+            blackboard_canvas.Cursor = System.Windows.Input.Cursors.Pen;
97 88
             wfhCamera.Visibility = Visibility.Hidden;
98
-
99
-
100 89
         }
101 90
         #endregion
102 91
 
@@ -169,9 +158,11 @@ namespace XHWK.WKTool
169 158
                 APP.W_ScreenRecordingToolbarWindow.Initialize();
170 159
             }
171 160
             //显示在右下角
172
-            APP.W_ScreenRecordingToolbarWindow.Show();
161
+
173 162
             APP.W_ScreenRecordingToolbarWindow.Left = PrimaryScreen.DESKTOP.Width - APP.W_ScreenRecordingToolbarWindow.Width - 10;
174
-            APP.W_ScreenRecordingToolbarWindow.Top = PrimaryScreen.DESKTOP.Height - APP.W_ScreenRecordingToolbarWindow.Height - 60;
163
+            APP.W_ScreenRecordingToolbarWindow.Top = PrimaryScreen.DESKTOP.Height - APP.W_ScreenRecordingToolbarWindow.Height - 160;
164
+            APP.W_ScreenRecordingToolbarWindow.Topmost = true;
165
+            APP.W_ScreenRecordingToolbarWindow.Show();
175 166
             Hide();
176 167
         }
177 168
         /// <summary>
@@ -297,12 +288,12 @@ namespace XHWK.WKTool
297 288
         /// <param name="e"></param>
298 289
         private void BtnWhite_Click(object sender, RoutedEventArgs e)
299 290
         {
300
-            //创建 DrawingAttributes 类的一个实例  
301
-            drawingAttributes = new DrawingAttributes();
302
-            //将 InkCanvas 的 DefaultDrawingAttributes 属性的值赋成创建的 DrawingAttributes 类的对象的引用  
303
-            //InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型  
304
-            blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
305
-            //设置 DrawingAttributes 的 Color 属性设置颜色  
291
+            ////创建 DrawingAttributes 类的一个实例  
292
+            //drawingAttributes = new DrawingAttributes();
293
+            ////将 InkCanvas 的 DefaultDrawingAttributes 属性的值赋成创建的 DrawingAttributes 类的对象的引用  
294
+            ////InkCanvas 通过 DefaultDrawingAttributes 属性来获取墨迹的各种设置,该属性的类型为 DrawingAttributes 型  
295
+            //blackboard_canvas.DefaultDrawingAttributes = drawingAttributes;
296
+            ////设置 DrawingAttributes 的 Color 属性设置颜色  
306 297
             drawingAttributes.Color = Colors.White;
307 298
         }
308 299
         /// <summary>
@@ -442,14 +433,39 @@ namespace XHWK.WKTool
442 433
             {
443 434
                 APP.W_JieTuWindow = new JieTuWindow();
444 435
                 // 订阅事件
445
-                //APP.W_JieTuWindow.ChangeTextEvent += new ChangeTextHandler(frm_ChangeTextEvent);
446
-                //APP.W_JieTuWindow.click_closeJietuWindowClick += JietuWindow_click_closeJietuWindowClick;
436
+                APP.W_JieTuWindow.ChangeTextEvent += new ChangeTextHandler(frm_ChangeTextEvent);
437
+                APP.W_JieTuWindow.click_closeJietuWindowClick += JietuWindow_click_closeJietuWindowClick;
447 438
                 APP.W_JieTuWindow.Show();
448 439
             }
449 440
 
450 441
             //imgCanvas.Source = new BitmapImage(new Uri(desktopPath));
451 442
         }
452 443
         /// <summary>
444
+        /// 截图关闭窗口
445
+        /// </summary>
446
+        /// <param name="text"></param>
447
+        private void frm_ChangeTextEvent(string text)
448
+        {
449
+            if ("关闭窗口".Equals(text))
450
+            {
451
+                if(!string.IsNullOrWhiteSpace(APP.ImgPath)&&File.Exists(APP.ImgPath))
452
+                {
453
+                    APP.JPaths[APP.pageData.currpage]= APP.ImgPath;
454
+                    if(!string.IsNullOrWhiteSpace(APP.JPaths[APP.pageData.currpage]))
455
+                    {
456
+                        imgCanvas.Source = new BitmapImage(new Uri(APP.JPaths[APP.pageData.currpage]));
457
+                    }
458
+                }
459
+            }
460
+        }
461
+        /// <summary>
462
+        /// 截图关闭 非正常关闭截图时,截图清空
463
+        /// </summary>
464
+        private void JietuWindow_click_closeJietuWindowClick()
465
+        {
466
+            APP.W_JieTuWindow = null;
467
+        }
468
+        /// <summary>
453 469
         /// 获取时间戳
454 470
         /// </summary>
455 471
         /// <returns></returns>
@@ -475,7 +491,7 @@ namespace XHWK.WKTool
475 491
                 string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
476 492
                 ofd = new System.Windows.Forms.OpenFileDialog
477 493
                 {
478
-                    Filter = "文档|*.docx;*.doc",
494
+                    Filter = "文档|*.docx;*.doc;*ppt",
479 495
                     InitialDirectory = desktopPath,
480 496
                     Multiselect = false,
481 497
                     AddExtension = true,
@@ -488,7 +504,7 @@ namespace XHWK.WKTool
488 504
                         Thread.Sleep(400);
489 505
                         Dispatcher.Invoke(new Action(() =>
490 506
                         {
491
-                            openDialog();
507
+                            OpenDialogPPT();
492 508
                         }
493 509
                             ));
494 510
                     })
@@ -501,7 +517,7 @@ namespace XHWK.WKTool
501 517
                 LogHelper.WriteErrLog("【导入(BtnImport_Click)" + ex.Message, ex);
502 518
             }
503 519
         }
504
-        private void openDialog()
520
+        private void OpenDialog()
505 521
         {
506 522
             result = ofd.ShowDialog();
507 523
             if (result == System.Windows.Forms.DialogResult.OK)
@@ -515,17 +531,85 @@ namespace XHWK.WKTool
515 531
                     for (int i = 0; i < APP.Paths.Length; i++)
516 532
                     {
517 533
                         APP.pageData.pagenum += 1;
518
-                        //APP.pageData.currpage = APP.pageData.pagenum;
519
-                        //myblackboard.changepage(APP.pageData.currpage - 1);
520 534
                     }
521 535
                     if (APP.pageData.pagenum > 1)
522 536
                     {
523 537
                         APP.pageData.pagenum -= 1;
524 538
                     }
525
-                    if (APP.pageData.currpage > 1)
539
+                    if (!string.IsNullOrWhiteSpace(txbCurrpage.Text) && APP.pageData.currpage < APP.Paths.Length)
540
+                    {
541
+                        imgCanvas.Source = new BitmapImage(new Uri(APP.Paths[APP.pageData.currpage - 1]));
542
+                    }
543
+                    else
544
+                    {
545
+                        imgCanvas.Source = null;
546
+                    }
547
+                }
548
+            }
549
+        }
550
+        private void OpenDialogPPT()
551
+        {
552
+            result = ofd.ShowDialog();
553
+            if (result == System.Windows.Forms.DialogResult.OK)
554
+            {
555
+                if (ofd.FileName != "")
556
+                {
557
+                    #region PPT转PDF
558
+                    string filepath = ofd.FileName;
559
+                    string path = ofd.SafeFileName.Replace(".ppt", "").Trim();
560
+                    string pathTemp = AppDomain.CurrentDomain.BaseDirectory + "Temp\\";
561
+                    path = pathTemp + path + ".pdf";
562
+                    //PPT转PDF
563
+                    Presentation ppt = new Presentation(filepath);
564
+                    ppt.Save(path, Aspose.Slides.Export.SaveFormat.Pdf); 
565
+                    #endregion
566
+
567
+
568
+                    #region PDF转图片
569
+                    // 图片绝对路径集合
570
+                    List<string> images = new List<string>();
571
+                    string directoryPath = pathTemp;
572
+                    //aspose许可证
573
+                    //Aspose.Pdf.License l = new Aspose.Pdf.License();
574
+                    //string licenseName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Aspose.Total.Product.Family.lic");
575
+                    //l.SetLicense(licenseName);
576
+                    //定义Jpeg转换设备
577
+                    Aspose.Pdf.Document document = new Aspose.Pdf.Document(path);
578
+                    var device = new Aspose.Pdf.Devices.JpegDevice();
579
+                    //int quality = int.Parse(this.comboBox1.SelectedItem.ToString());
580
+                    //directoryPath += quality;
581
+                    Directory.CreateDirectory(directoryPath);
582
+                    //默认质量为100,设置质量的好坏与处理速度不成正比,甚至是设置的质量越低反而花的时间越长,怀疑处理过程是先生成高质量的再压缩
583
+                    device = new Aspose.Pdf.Devices.JpegDevice(100);
584
+                    //遍历每一页转为jpg
585
+                    for (var i = 1; i <= document.Pages.Count; i++)
586
+                    {
587
+                        long ii = Timestamp();
588
+                        string filePathOutPut = Path.Combine(directoryPath, string.Format("{0}{1}.jpg", ii, i));
589
+                        images.Add(filePathOutPut);
590
+                        FileStream fs = new FileStream(filePathOutPut, FileMode.OpenOrCreate);
591
+                        try
592
+                        {
593
+                            device.Process(document.Pages[i], fs);
594
+                            fs.Close();
595
+                        }
596
+                        catch (Exception ex)
597
+                        {
598
+                            fs.Close();
599
+                            File.Delete(filePathOutPut);
600
+                        }
601
+                    } 
602
+                    #endregion
603
+
604
+                    APP.Paths = images.ToArray(); 
605
+
606
+                    for (int i = 0; i < APP.Paths.Length; i++)
607
+                    {
608
+                        APP.pageData.pagenum += 1;
609
+                    }
610
+                    if (APP.pageData.pagenum > 1)
526 611
                     {
527
-                        //APP.pageData.currpage -= 1;
528
-                        //myblackboard.changepage(APP.pageData.currpage - 1);
612
+                        APP.pageData.pagenum -= 1;
529 613
                     }
530 614
                     if (!string.IsNullOrWhiteSpace(txbCurrpage.Text) && APP.pageData.currpage < APP.Paths.Length)
531 615
                     {
@@ -538,7 +622,16 @@ namespace XHWK.WKTool
538 622
                 }
539 623
             }
540 624
         }
541
-
625
+        /// <summary>
626
+        /// 返回一个时间戳到毫秒
627
+        /// </summary>
628
+        /// <returns></returns>
629
+        public static long Timestamp()
630
+        {
631
+            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
632
+            long timestr = Convert.ToInt64(ts.TotalMilliseconds);
633
+            return timestr;
634
+        }
542 635
         #region 录制窗口
543 636
         #region 变量
544 637
         /// <summary>
@@ -573,7 +666,6 @@ namespace XHWK.WKTool
573 666
         /// 是否开始截图计数
574 667
         /// </summary>
575 668
         bool IsStartCount = false;
576
-
577 669
         #endregion
578 670
         /// <summary>
579 671
         /// 录制窗口内容
@@ -587,6 +679,8 @@ namespace XHWK.WKTool
587 679
                 Login();
588 680
                 return;
589 681
             }
682
+
683
+            blackboard_canvas.Visibility = Visibility.Visible;
590 684
             StartRecord();
591 685
         }
592 686
         /// <summary>
@@ -601,6 +695,7 @@ namespace XHWK.WKTool
601 695
                 Login();
602 696
                 return;
603 697
             }
698
+            blackboard_canvas.Visibility = Visibility.Collapsed;
604 699
             EndRecord();
605 700
         }
606 701
         System.Timers.Timer timer;
@@ -813,6 +908,10 @@ namespace XHWK.WKTool
813 908
                 Login();
814 909
                 return;
815 910
             }
911
+            APP.pageData.pagenum += 1;
912
+            APP.pageData.currpage = APP.pageData.pagenum;
913
+            myblackboard.changepage(APP.pageData.currpage - 1);
914
+            imgCanvas.Source = null;
816 915
         }
817 916
         /// <summary>
818 917
         /// 打印事件
@@ -858,6 +957,10 @@ namespace XHWK.WKTool
858 957
                         imgCanvas.Source = null;
859 958
                     }
860 959
                 }
960
+                if (!string.IsNullOrWhiteSpace(APP.JPaths[APP.pageData.currpage]))
961
+                {
962
+                    imgCanvas.Source = new BitmapImage(new Uri(APP.JPaths[APP.pageData.currpage]));
963
+                }
861 964
             }
862 965
 
863 966
         }
@@ -875,7 +978,7 @@ namespace XHWK.WKTool
875 978
                 if (APP.Paths.Length > 0)
876 979
                 {
877 980
 
878
-                    if (!string.IsNullOrWhiteSpace(txbCurrpage.Text) && APP.pageData.currpage < APP.Paths.Length)
981
+                    if (!string.IsNullOrWhiteSpace(txbCurrpage.Text) && APP.pageData.currpage <= APP.Paths.Length)
879 982
                     {
880 983
                         imgCanvas.Source = new BitmapImage(new Uri(APP.Paths[APP.pageData.currpage-1]));
881 984
                     }
@@ -884,20 +987,13 @@ namespace XHWK.WKTool
884 987
                         imgCanvas.Source = null;
885 988
                     }
886 989
                 }
990
+                if (!string.IsNullOrWhiteSpace(APP.JPaths[APP.pageData.currpage]))
991
+                {
992
+                    imgCanvas.Source = new BitmapImage(new Uri(APP.JPaths[APP.pageData.currpage]));
993
+                }
887 994
             }
888 995
         }
889 996
         /// <summary>
890
-        /// 添加
891
-        /// </summary>
892
-        /// <param name="sender"></param>
893
-        /// <param name="e"></param>
894
-        private void add_button_Click(object sender, RoutedEventArgs e)
895
-        {
896
-            APP.pageData.pagenum += 1;
897
-            APP.pageData.currpage = APP.pageData.pagenum;
898
-            myblackboard.changepage(APP.pageData.currpage - 1);
899
-        }
900
-        /// <summary>
901 997
         /// 将Word文档转换为图片的方法(该方法基于第三方DLL),你可以像这样调用该方法: ConvertPDF2Image("F:\\PdfFile.doc", "F:\\",
902 998
         /// "ImageFile", 1, 20, ImageFormat.Png, 256);
903 999
         /// </summary>
@@ -978,70 +1074,95 @@ namespace XHWK.WKTool
978 1074
             return sf;
979 1075
         }
980 1076
 
981
-
982
-
983
-
984
-
985
-
986
-        private bool m_IsMouseLeftButtonDown;
987
-
988
-        private void MasterImage_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
1077
+        #region 图像缩放,移动
1078
+        private bool mouseDown;
1079
+        private System.Windows.Point mouseXY;
1080
+        private void IMG1_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
989 1081
         {
990
-            Rectangle rectangle = sender as Rectangle;
991
-            if (rectangle == null)
1082
+            var img = sender as ContentControl;
1083
+            if (img == null)
1084
+            {
992 1085
                 return;
1086
+            }
1087
+            img.CaptureMouse();
1088
+            mouseDown = true;
1089
+            mouseXY = e.GetPosition(img);
1090
+            Console.WriteLine("mouseXY.X = " + mouseXY.X + "; mouseXY.Y = " + mouseXY.Y);
993 1091
 
994
-            rectangle.ReleaseMouseCapture();
995
-            m_IsMouseLeftButtonDown = false;
996 1092
         }
997
-
998
-        private Point m_PreviousMousePoint;
999
-        private void MasterImage_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
1093
+        private void PicEMap_MouseDown(object sender, MouseButtonEventArgs e)
1094
+        {
1095
+            System.Windows.Point point = e.GetPosition(imgCanvas);
1096
+            //Console.WriteLine("PicEmap.X = " + point.X + "; PicEmap.Y = " + point.Y);
1097
+            //if ((point.X - 304) * (point.X - 304) + (point.Y - 86) * (point.Y - 86) < 100) 
1098
+            //{
1099
+            //    Console.WriteLine("在范围内");
1100
+            //}
1101
+        }
1102
+        private void IMG1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
1000 1103
         {
1001
-            Rectangle rectangle = sender as Rectangle;
1002
-            if (rectangle == null)
1104
+            var img = sender as ContentControl;
1105
+            if (img == null)
1106
+            {
1003 1107
                 return;
1004
-
1005
-            rectangle.CaptureMouse();
1006
-            m_IsMouseLeftButtonDown = true;
1007
-            m_PreviousMousePoint = e.GetPosition(rectangle);
1108
+            }
1109
+            img.ReleaseMouseCapture();
1110
+            mouseDown = false;
1008 1111
         }
1009
-
1010
-        private void MasterImage_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
1112
+        private void IMG1_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
1011 1113
         {
1012
-            Rectangle rectangle = sender as Rectangle;
1013
-            if (rectangle == null)
1114
+            var img = sender as ContentControl;
1115
+            if (img == null)
1116
+            {
1014 1117
                 return;
1015
-
1016
-            if (m_IsMouseLeftButtonDown)
1017
-                DoImageMove(rectangle, e);
1118
+            }
1119
+            if (mouseDown)
1120
+            {
1121
+                Domousemove(img, e);
1122
+            }
1018 1123
         }
1019
-
1020
-        private void DoImageMove(Rectangle rectangle, System.Windows.Input.MouseEventArgs e)
1124
+        private void Domousemove(ContentControl img, System.Windows.Input.MouseEventArgs e)
1021 1125
         {
1022
-            //Debug.Assert(e.LeftButton == MouseButtonState.Pressed); 
1023 1126
             if (e.LeftButton != MouseButtonState.Pressed)
1127
+            {
1128
+                return;
1129
+            }
1130
+            var group = IMG.FindResource("Imageview") as TransformGroup;
1131
+            var transform = group.Children[1] as TranslateTransform;
1132
+            var position = e.GetPosition(img);
1133
+            transform.X -= mouseXY.X - position.X;
1134
+            transform.Y -= mouseXY.Y - position.Y;
1135
+            mouseXY = position;
1136
+        }
1137
+        private void IMG1_MouseWheel(object sender, MouseWheelEventArgs e)
1138
+        {
1139
+            var img = sender as ContentControl;
1140
+            if (img == null)
1141
+            {
1024 1142
                 return;
1143
+            }
1144
+            var point = e.GetPosition(img);
1145
+            Console.WriteLine("point.X = " + point.X + "; point.Y=" + point.Y);
1146
+            var PicLocate = e.GetPosition(imgCanvas);
1147
+            Console.WriteLine("PicEmap.X = " + PicLocate.X + "; PicEmap.Y=" + PicLocate.Y);
1025 1148
 
1026
-            TransformGroup group = GridMain.FindResource("ImageTransformResource") as TransformGroup;
1027
-            Debug.Assert(group != null);
1028
-            TranslateTransform transform = group.Children[1] as TranslateTransform;
1029
-            Point position = e.GetPosition(rectangle);
1030
-            transform.X += position.X - m_PreviousMousePoint.X;
1031
-            transform.Y += position.Y - m_PreviousMousePoint.Y;
1032 1149
 
1033
-            m_PreviousMousePoint = position;
1150
+            var group = IMG.FindResource("Imageview") as TransformGroup;
1151
+            var delta = e.Delta * 0.001;
1152
+            DowheelZoom(group, point, delta);
1034 1153
         }
1035
-
1036
-        private void MasterImage_MouseWheel(object sender, MouseWheelEventArgs e)
1154
+        private void DowheelZoom(TransformGroup group, System.Windows.Point point, double delta)
1037 1155
         {
1038
-            TransformGroup group = GridMain.FindResource("ImageTransformResource") as TransformGroup;
1039
-            Debug.Assert(group != null);
1040
-            ScaleTransform transform = group.Children[0] as ScaleTransform;
1041
-            transform.ScaleX += e.Delta * 0.001;
1042
-            transform.ScaleY += e.Delta * 0.001;
1156
+            var pointToContent = group.Inverse.Transform(point);
1157
+            var transform = group.Children[0] as ScaleTransform;
1158
+            if (transform.ScaleX + delta < 0.1) return;
1159
+            transform.ScaleX += delta;
1160
+            transform.ScaleY += delta;
1161
+            var transform1 = group.Children[1] as TranslateTransform;
1162
+            transform1.X = -1 * ((pointToContent.X * transform.ScaleX) - point.X);
1163
+            transform1.Y = -1 * ((pointToContent.Y * transform.ScaleY) - point.Y);
1164
+            //Console.WriteLine("transform.ScaleX = " + transform.ScaleX + "; transform.ScaleY = " + transform.ScaleY);
1043 1165
         }
1044
-
1045
-
1166
+        #endregion
1046 1167
     }
1047 1168
 }

+ 13
- 0
XHWK.WKTool/XHWK.WKTool.csproj 파일 보기

@@ -53,6 +53,12 @@
53 53
     <Reference Include="AForge.Video.DirectShow, Version=2.2.5.0, Culture=neutral, PublicKeyToken=61ea4348d43881b7, processorArchitecture=MSIL">
54 54
       <HintPath>..\packages\AForge.Video.DirectShow.2.2.5\lib\AForge.Video.DirectShow.dll</HintPath>
55 55
     </Reference>
56
+    <Reference Include="Aspose.PDF, Version=19.1.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56, processorArchitecture=MSIL">
57
+      <HintPath>..\packages\Aspose.PDF.19.1.0\lib\net4.0\Aspose.PDF.dll</HintPath>
58
+    </Reference>
59
+    <Reference Include="Aspose.Slides">
60
+      <HintPath>..\dl\Aspose.Slides.dll</HintPath>
61
+    </Reference>
56 62
     <Reference Include="Aspose.Words">
57 63
       <HintPath>..\dl\Aspose.Words.dll</HintPath>
58 64
     </Reference>
@@ -118,6 +124,9 @@
118 124
     <Compile Include="Models\EntityBase.cs" />
119 125
     <Compile Include="Models\Limit.cs" />
120 126
     <Compile Include="Models\Tool.cs" />
127
+    <Compile Include="PracticeWindow.xaml.cs">
128
+      <DependentUpon>PracticeWindow.xaml</DependentUpon>
129
+    </Compile>
121 130
     <Compile Include="ScreenRecordingToolbarWindow.xaml.cs">
122 131
       <DependentUpon>ScreenRecordingToolbarWindow.xaml</DependentUpon>
123 132
     </Compile>
@@ -144,6 +153,10 @@
144 153
       <SubType>Designer</SubType>
145 154
       <Generator>MSBuild:Compile</Generator>
146 155
     </Page>
156
+    <Page Include="PracticeWindow.xaml">
157
+      <SubType>Designer</SubType>
158
+      <Generator>MSBuild:Compile</Generator>
159
+    </Page>
147 160
     <Page Include="Themes\Generic.xaml">
148 161
       <Generator>MSBuild:Compile</Generator>
149 162
       <SubType>Designer</SubType>

+ 1
- 0
XHWK.WKTool/packages.config 파일 보기

@@ -6,5 +6,6 @@
6 6
   <package id="AForge.Math" version="2.2.5" targetFramework="net452" />
7 7
   <package id="AForge.Video" version="2.2.5" targetFramework="net452" />
8 8
   <package id="AForge.Video.DirectShow" version="2.2.5" targetFramework="net452" />
9
+  <package id="Aspose.PDF" version="19.1.0" targetFramework="net452" />
9 10
   <package id="WpfAnimatedGif" version="2.0.0" targetFramework="net452" />
10 11
 </packages>

BIN
dl/Aspose.Slides.dll 파일 보기


BIN
dl/O2S.Components.PDFRender4NET.dll 파일 보기


Loading…
취소
저장