Browse Source

zhao:优化录制和录屏,录制时间过短提示

tags/录制修改前
耀 4 years ago
parent
commit
6f91a1a565

+ 2
- 2
XHWK.WKTool/App.config View File

@@ -33,8 +33,8 @@
33 33
     <!--上传每片大小 Mb-->
34 34
     <add key="UploadSliceLen" value="1" />
35 35
     <!--版本号-->
36
-    <add key="VersionCode" value="20" />
37
-    <add key="VersionName" value="1.1.9" />
36
+    <add key="VersionCode" value="23" />
37
+    <add key="VersionName" value="1.2.2" />
38 38
     <add key="ClientSettingsProvider.ServiceUri" value="" />
39 39
   </appSettings>
40 40
   <system.web>

+ 10
- 1
XHWK.WKTool/App.cs View File

@@ -239,7 +239,16 @@ namespace XHWK.WKTool
239 239
                 //}
240 240
                 #endregion
241 241
 
242
-
242
+                try
243
+                {
244
+                    if(Directory.Exists(AppDomain.CurrentDomain.BaseDirectory+"temp"))//清除临时文件
245
+                    {
246
+                        Directory.Delete(AppDomain.CurrentDomain.BaseDirectory + "temp",true);
247
+                    }
248
+                }
249
+                catch (Exception ex)
250
+                {
251
+                }
243 252
 
244 253
                 //如果本地文件为空,弹出弹窗 输密匙
245 254
                 //本地文件不为空, 解析

+ 2
- 0
XHWK.WKTool/CreateAMicroLessonWindow.xaml.cs View File

@@ -108,6 +108,8 @@ namespace XHWK.WKTool
108 108
             }
109 109
             //创建文件夹
110 110
             FileToolsCommon.CreateDirectory(APP.WKData.WkPath);
111
+            FileToolsCommon.DeleteDirectory(wkpath + "temp");
112
+            FileToolsCommon.DeleteDirectory(wkpath + "temprs");
111 113
             //存储文件
112 114
             FileToolsCommon.SetConfigValue("VideoSavePath", txbStoragePath.Text);
113 115
             APP.ReadDrawData();

+ 169
- 1
XHWK.WKTool/PrintWindow.xaml.cs View File

@@ -3,6 +3,8 @@
3 3
 using System;
4 4
 using System.Collections.Generic;
5 5
 using System.Data;
6
+using System.Drawing;
7
+using System.IO;
6 8
 using System.Threading;
7 9
 using System.Windows;
8 10
 using System.Windows.Input;
@@ -54,8 +56,12 @@ namespace XHWK.WKTool
54 56
                 cmbClass.SelectedIndex = 0;
55 57
             }
56 58
         }
57
-        public void Initialize(string _imgPath)
59
+        double wit = 0;
60
+        double hei = 0;
61
+        public void Initialize(string _imgPath, double _wit,double _hei)
58 62
         {
63
+            wit = _wit;
64
+            hei = _hei;
59 65
             if (!string.IsNullOrWhiteSpace(_imgPath))
60 66
             {
61 67
                 imgPri.Source = new BitmapImage(new Uri(_imgPath));
@@ -136,6 +142,111 @@ namespace XHWK.WKTool
136 142
         /// </summary>
137 143
         void StartPrint(object obj)
138 144
         {
145
+          
146
+                try
147
+            {
148
+                iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 0, 0, 0, 0);
149
+                //iTextSharp.text.Rectangle page = new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.A4., 250f);//cs
150
+                ////设置纸张横向
151
+                //document.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
152
+                int ipdf = 102;
153
+                string imgPath = FileToolsCommon.GetFileAbsolutePath("temp/");
154
+                string tempImgPath = imgPath;
155
+                FileToolsCommon.CreateDirectory(imgPath);
156
+                imgPath += "101.pdf";
157
+                while(File.Exists(imgPath))
158
+                {
159
+                    imgPath = tempImgPath + ipdf.ToString() + ".pdf";
160
+                    ipdf++;
161
+                }
162
+                iTextSharp.text.pdf.PdfWriter.GetInstance(document, new FileStream(imgPath, FileMode.Create, FileAccess.ReadWrite));
163
+                document.Open();
164
+                iTextSharp.text.Image image;
165
+                for (int i = 0; i < APP.PageDrawList.Count; i++)
166
+                {
167
+                    long ii = Timestamp();
168
+                    string directoryPath = AppDomain.CurrentDomain.BaseDirectory + "Temp\\";
169
+                    string filePathOutPut = Path.Combine(directoryPath, string.Format("print{0}{1}.jpg", ii, i));
170
+                    RectangleF rectangleFs = new RectangleF();
171
+                    MergerImg("", filePathOutPut, rectangleFs, out string errmsg);
172
+                    image = iTextSharp.text.Image.GetInstance(filePathOutPut);
173
+                    if (string.IsNullOrEmpty(APP.PageDrawList[i].PageImagePath))//没有图片
174
+                    {
175
+
176
+                    }
177
+                    else if (APP.PageDrawList[i].ImgDocumentation == true && !APP.PageDrawList[i].Type.Equals("ppt"))
178
+                    {
179
+                        image = iTextSharp.text.Image.GetInstance(APP.PageDrawList[i].PageImagePath);
180
+                    }
181
+                    else
182
+                    {
183
+                        RectangleF rectangleF = new RectangleF(0,0,0,0) ;
184
+                        Dispatcher.Invoke(() =>
185
+                        {
186
+                             rectangleF = new RectangleF
187
+                            {
188
+                                Width = (float)APP.PageDrawList[i].ImageSizes.CenterX,
189
+                                Height = (float)APP.PageDrawList[i].ImageSizes.CenterY,
190
+                                X = (float)APP.PageDrawList[i].ImageLocation.X,
191
+                                Y = (float)APP.PageDrawList[i].ImageLocation.Y
192
+                            };
193
+                        });
194
+                   
195
+
196
+
197
+                        string msgs = string.Empty;
198
+
199
+               
200
+                            bool isImg = MergerImg(APP.PageDrawList[i].PageImagePath, filePathOutPut, rectangleF, out msgs);
201
+                            if (isImg)
202
+                            {
203
+                                image = iTextSharp.text.Image.GetInstance(filePathOutPut);
204
+                            }
205
+                            else
206
+                            {
207
+                                image = iTextSharp.text.Image.GetInstance(APP.PageDrawList[i].PageImagePath);
208
+                            }
209
+                   
210
+                     
211
+                    }
212
+                    if (image.Height > iTextSharp.text.PageSize.A4.Height)
213
+                    {
214
+                        image.ScaleToFit(iTextSharp.text.PageSize.A4.Width, iTextSharp.text.PageSize.A4.Height);
215
+                    }
216
+                    else if (image.Width > iTextSharp.text.PageSize.A4.Width)
217
+                    {
218
+                        image.ScaleToFit(iTextSharp.text.PageSize.A4.Width, iTextSharp.text.PageSize.A4.Height);
219
+                    }
220
+                    image.Alignment = iTextSharp.text.Image.ALIGN_MIDDLE;
221
+                    document.NewPage();
222
+                    document.Add(image);
223
+                    //iTextSharp.text.Chunk c1 = new iTextSharp.text.Chunk("Hello World");
224
+                    //iTextSharp.text.Phrase p1 = new iTextSharp.text.Phrase();
225
+                    //p1.Leading = 150;      //行间距
226
+                    //document.Add(p1);
227
+                }
228
+                Console.WriteLine("转换成功!");
229
+                document.Close();
230
+            }
231
+            catch (Exception ex)
232
+            {
233
+
234
+
235
+
236
+                Dispatcher.Invoke(() =>
237
+                {
238
+                    btnClose.IsEnabled = true;
239
+                    btnPrint.IsEnabled = true;
240
+                    times.Stop();
241
+                    tip_outer.Visibility = Visibility.Collapsed;
242
+                    MessageWindow.Show(ex.Message);
243
+                    return;
244
+                });
245
+                LogHelper.WriteErrLog("打印转换PDF失败,原因:" + ex.Message,ex);
246
+            }
247
+
248
+
249
+
139 250
             List<string> objStr = (List<string>)obj;
140 251
             string SourcePath= objStr[0];
141 252
             int PrinterNum=int.Parse(objStr[1]);
@@ -183,7 +294,64 @@ namespace XHWK.WKTool
183 294
                 });
184 295
             }
185 296
         }
297
+        /// <summary>
298
+        /// 返回一个时间戳到毫秒
299
+        /// </summary>
300
+        /// <returns></returns>
301
+        public static long Timestamp()
302
+        {
303
+            TimeSpan ts = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);
304
+            long timestr = Convert.ToInt64(ts.TotalMilliseconds);
305
+            return timestr;
306
+        }
307
+        /// <summary>
308
+        /// 生成图片
309
+        /// </summary>
310
+        /// <param name="_path">图片地址</param>
311
+        /// <param name="_saveimg">保存位置</param>
312
+        /// <param name="_rectangle">图片位置</param>
313
+        /// <param name="errmsg">错误消息</param>
314
+        /// <returns></returns>
315
+        private bool MergerImg(string _path, string _saveimg, RectangleF _rectangle, out string errmsg)
316
+        {
317
+            errmsg = null;
318
+            try
319
+            {
320
+                Bitmap bitmap = null;
186 321
 
322
+                //创建要显示的图片对象,根据参数的个数设置宽度
323
+                Bitmap backgroudImg = new Bitmap((int)/*gridM.ActualWidth*/wit, (int)/*gridM.ActualHeight*/hei);
324
+                Graphics g = Graphics.FromImage(backgroudImg);
325
+                //清除画布,背景设置为白色
326
+                g.Clear(System.Drawing.Color.White);
327
+
328
+                if (!string.IsNullOrWhiteSpace(_path))
329
+                {
330
+                    bitmap = ImageHelper.ReadBitmapFile(_path);
331
+                    g.DrawImage(bitmap, _rectangle);
332
+                }
333
+
334
+
335
+                backgroudImg.Save(_saveimg);
336
+
337
+                g.Dispose();
338
+                backgroudImg.Dispose();
339
+                if (bitmap != null)
340
+                {
341
+                    bitmap.Dispose();
342
+                }
343
+
344
+                GC.Collect();
345
+                return true;
346
+            }
347
+            catch (Exception ex)
348
+            {
349
+                errmsg = ex.Message;
350
+                LogHelper.WriteErrLog("【截图合成】(MergerImg)图片合成失败:" + ex.Message, ex);
351
+                return false;
352
+            }
353
+
354
+        }
187 355
         /// <summary>
188 356
         /// 打印-开始
189 357
         /// </summary>

+ 2
- 2
XHWK.WKTool/Properties/AssemblyInfo.cs View File

@@ -49,5 +49,5 @@ using System.Windows;
49 49
 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
50 50
 //通过使用 "*",如下所示:
51 51
 // [assembly: AssemblyVersion("1.0.*")]
52
-[assembly: AssemblyVersion("1.1.9.0")]
53
-[assembly: AssemblyFileVersion("1.1.9.0")]
52
+[assembly: AssemblyVersion("1.2.2.0")]
53
+[assembly: AssemblyFileVersion("1.2.2.0")]

+ 52
- 43
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs View File

@@ -347,7 +347,7 @@ namespace XHWK.WKTool
347 347
                 imgBlackPenTwo.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar28.png"));
348 348
                 btnBlackPenTwo.IsEnabled = true;//红笔可点击
349 349
                 txbTime.Visibility = Visibility.Visible;//时间显示
350
-                imgReturn.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar30.png"));
350
+                //imgReturn.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar30.png"));
351 351
                 //borOne.Background = new SolidColorBrush(Colors.LightBlue);
352 352
                 //btnReturn.IsEnabled = false;//返回主界面可点击
353 353
 
@@ -356,12 +356,12 @@ namespace XHWK.WKTool
356 356
                     #region 4秒内不可点击
357 357
                     new Thread(new ThreadStart(new Action(() =>
358 358
                     {
359
-                        Dispatcher.Invoke(() =>
360
-                        {
361
-                            ImgEndRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar15.png"));
362
-                            BtnRecordingScreen.IsEnabled = false;
363
-                            BtnStopRecordingScreen.IsEnabled = false;
364
-                        });
359
+                        //Dispatcher.Invoke(() =>
360
+                        //{
361
+                        //    ImgEndRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar15.png"));
362
+                        //    BtnRecordingScreen.IsEnabled = false;
363
+                        //    BtnStopRecordingScreen.IsEnabled = false;
364
+                        //});
365 365
                         //Thread.Sleep(4000);
366 366
                         Dispatcher.Invoke(() =>
367 367
                         {
@@ -406,17 +406,17 @@ namespace XHWK.WKTool
406 406
                 //imgBlackPenTwo.Source = new BitmapImage(new Uri("pack://application:,,,/Images/31.png"));
407 407
                 //btnBlackPenTwo.IsEnabled = false;//红笔不可点击
408 408
                 txbTime.Visibility = Visibility.Hidden;//时间不显示
409
-                imgReturn.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar29.png"));
409
+                //imgReturn.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar29.png"));
410 410
                 //btnReturn.IsEnabled = true;//返回主界面可点击
411 411
                 #region 2秒内不可点击
412 412
                 new Thread(new ThreadStart(new Action(() =>
413 413
                 {
414
-                    Dispatcher.Invoke(() =>
415
-                    {
416
-                        ImgEndRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar15.png"));
417
-                        BtnRecordingScreen.IsEnabled = false;
418
-                        BtnStopRecordingScreen.IsEnabled = false;
419
-                    });
414
+                    //Dispatcher.Invoke(() =>
415
+                    //{
416
+                    //    ImgEndRecordingScreen.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar15.png"));
417
+                    //    BtnRecordingScreen.IsEnabled = false;
418
+                    //    BtnStopRecordingScreen.IsEnabled = false;
419
+                    //});
420 420
                     //Thread.Sleep(2000);
421 421
                     Dispatcher.Invoke(() =>
422 422
                     {
@@ -446,7 +446,6 @@ namespace XHWK.WKTool
446 446
             k_hook.Stop();
447 447
             IsSuspend = true;
448 448
             txbTime.Text = "00:00";
449
-
450 449
             txbTime.Visibility = Visibility.Hidden;
451 450
             End();
452 451
             if (APP.W_PracticeWindow != null)
@@ -471,41 +470,51 @@ namespace XHWK.WKTool
471 470
             {
472 471
                 try
473 472
                 {
474
-                    try
475
-                    {
476
-                        APP.FFmpeg.StopFFmpeg(VideoSavePathName);
477
-                    }
478
-                    catch (Exception ex)
479
-                    {
480
-                        LogHelper.WriteErrLog("【停止录屏】(BtnStopRecordingScreen_Click)" + ex.Message, ex);
481
-                    }
482
-                    IsFirstRS = true;
483
-                    //生成缩略图
484
-                    string ThumbnailPath = FileToolsCommon.GetDirectoryName(VideoSavePathName) + "ThumbnailPath/";
485
-                    FileToolsCommon.CreateDirectory(ThumbnailPath);
486
-                    //缩略图存储位置
487
-                    string ThumbnailPathName = ThumbnailPath + FileToolsCommon.GetIOFileName(VideoSavePathName).Replace(".", "") + ".JPG";
488
-                    new Thread(new ThreadStart(new Action(() =>
473
+                    if (_timeSpan.Minutes > 0 || _timeSpan.Seconds > 3)
489 474
                     {
490
-                        while (!FileToolsCommon.IsExistFile(VideoSavePathName))
475
+                        try
491 476
                         {
492
-                            Thread.Sleep(100);
477
+                            APP.FFmpeg.StopFFmpeg(VideoSavePathName);
493 478
                         }
494
-                        FileToolsCommon.DeleteFile(ThumbnailPathName);
479
+                        catch (Exception ex)
480
+                        {
481
+                            LogHelper.WriteErrLog("【停止录屏】(BtnStopRecordingScreen_Click)" + ex.Message, ex);
482
+                        }
483
+                        IsFirstRS = true;
484
+                        //生成缩略图
485
+                        string ThumbnailPath = FileToolsCommon.GetDirectoryName(VideoSavePathName) + "ThumbnailPath/";
486
+                        FileToolsCommon.CreateDirectory(ThumbnailPath);
487
+                        //缩略图存储位置
488
+                        string ThumbnailPathName = ThumbnailPath + FileToolsCommon.GetIOFileName(VideoSavePathName).Replace(".", "") + ".JPG";
489
+                        new Thread(new ThreadStart(new Action(() =>
490
+                        {
491
+                            while (!FileToolsCommon.IsExistFile(VideoSavePathName))
492
+                            {
493
+                                Thread.Sleep(100);
494
+                            }
495
+                            FileToolsCommon.DeleteFile(ThumbnailPathName);
495 496
                         //VideoInfo.VideoSize = FileToolsCommon.GetFileSizeByMB(VideoSavePathName).ToString() + " MB";
496 497
                         VideoInfo.RSTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
497
-                        VideoInfo.VideoPath = VideoSavePathName;
498
-                        VideoInfo.ThumbnailPath = ThumbnailPathName;
499
-                        APP.FFmpeg.GenerateThumbnails(VideoSavePathName, ThumbnailPathName,200,130);
500
-                        VideoInfo.FileGuid = Guid.NewGuid().ToString();
501
-                        VideoInfo.IsUpload = false;
502
-                        VideoInfo.Uploaded = 0;
503
-                        VideoInfo.Savefolder = APP.UserInfo.Schoolid + "/resource";
504
-                        APP.VideoList.Add(VideoInfo);
498
+                            VideoInfo.VideoPath = VideoSavePathName;
499
+                            VideoInfo.ThumbnailPath = ThumbnailPathName;
500
+                            APP.FFmpeg.GenerateThumbnails(VideoSavePathName, ThumbnailPathName, 200, 130);
501
+                            VideoInfo.FileGuid = Guid.NewGuid().ToString();
502
+                            VideoInfo.IsUpload = false;
503
+                            VideoInfo.Uploaded = 0;
504
+                            VideoInfo.Savefolder = APP.UserInfo.Schoolid + "/resource";
505
+                            APP.VideoList.Add(VideoInfo);
505 506
                         //保存数据
506 507
                         APP.SaveWkData();
507
-                    }))).Start();
508
-                    Click_stopRecordingScreen();
508
+                        }))).Start();
509
+                        Click_stopRecordingScreen();
510
+                    }
511
+                    else
512
+                    {
513
+                        //视频过短
514
+                        APP.FFmpeg.SuspendFFmpeg();
515
+                        IsFirstRS = true;
516
+                        MessageWindow.Show("保存失败,录屏时间过短!");
517
+                    }
509 518
                 }
510 519
                 catch (Exception ex)
511 520
                 {

+ 91
- 92
XHWK.WKTool/XHMicroLessonSystemWindow.xaml View File

@@ -297,20 +297,20 @@
297 297
             </Grid>
298 298
             <!--主内容-->
299 299
             <Border  Grid.Row="1">
300
-            <Grid Grid.Row="1" x:Name="GridMain" Visibility="Visible" MouseLeftButtonDown="Window_MouseLeftButtonDown_1">
301
-                <ScrollViewer x:Name="scroMain" VerticalScrollBarVisibility="Visible" MouseLeftButtonDown="Window_MouseLeftButtonDown_1">
302
-                    <Grid x:Name="gridM"  Margin="0,0,0,0" Background="#FFFFFF" Visibility="Visible" Height="1780" MouseLeftButtonDown="Window_MouseLeftButtonDown_1">
303
-                        <Grid>
304
-                            <Border Grid.Row="1"  CornerRadius="5">
305
-                                <Grid x:Name="IMG" Margin="0,0,0,0">
306
-                                    <Grid.Resources>
307
-                                        <TransformGroup x:Key="Imageview">
308
-                                            <ScaleTransform/>
309
-                                            <TranslateTransform/>
310
-                                        </TransformGroup>
311
-                                    </Grid.Resources>
312
-
313
-                                    <!--<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled"   Cursor="SizeAll"
300
+                <Grid Grid.Row="1" x:Name="GridMain" Visibility="Visible" MouseLeftButtonDown="Window_MouseLeftButtonDown_1">
301
+                    <ScrollViewer x:Name="scroMain" VerticalScrollBarVisibility="Visible" MouseLeftButtonDown="Window_MouseLeftButtonDown_1">
302
+                        <Grid x:Name="gridM"  Margin="0,0,0,0" Background="#FFFFFF" Visibility="Visible" Height="1780" MouseLeftButtonDown="Window_MouseLeftButtonDown_1">
303
+                            <Grid>
304
+                                <Border Grid.Row="1"  CornerRadius="5">
305
+                                    <Grid x:Name="IMG" Margin="0,0,0,0">
306
+                                        <Grid.Resources>
307
+                                            <TransformGroup x:Key="Imageview">
308
+                                                <ScaleTransform/>
309
+                                                <TranslateTransform/>
310
+                                            </TransformGroup>
311
+                                        </Grid.Resources>
312
+
313
+                                        <!--<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Disabled"   Cursor="SizeAll"
314 314
                   Margin="0,0,0,0" Focusable="False" x:Name="BackFrame">
315 315
                                             <ContentControl  MouseLeftButtonDown="IMG1_MouseLeftButtonDown"   
316 316
                              MouseLeftButtonUp="IMG1_MouseLeftButtonUp"
@@ -318,84 +318,45 @@
318 318
                              MouseWheel="IMG1_MouseWheel" >
319 319
                                             </ContentControl>
320 320
                                         </ScrollViewer>-->
321
-                                    <!--图片表框 -->
322
-                                    <Rectangle x:Name="RectImgBorder" Cursor="SizeAll" Fill="#00000000" HorizontalAlignment="Left" Stroke="#2D8CF0" VerticalAlignment="Top" Width="300" Height="300" Visibility="Hidden" Margin="373,175,0,0" StrokeThickness="4" StrokeDashArray="4 4" SnapsToDevicePixels="True"/>
323
-                                    <Image Name="imgCanvas" Height="0" VerticalAlignment="Top" HorizontalAlignment="Left" Stretch="Fill" MouseDown="PicEMap_MouseDown" RenderTransform="{StaticResource Imageview}" MouseRightButtonDown="imgCanvas_MouseRightButtonDown" MouseLeftButtonDown="imgCanvas_MouseLeftButtonDown" Focusable="True" MouseMove="imgCanvas_MouseMove" MouseUp="imgCanvas_MouseUp"/>
324
-                                    <!--四个点 -->
325
-                                    <Canvas>
326
-                                        <Thumb x:Name="RectLeftUp" Cursor="SizeNWSE"  HorizontalAlignment="Left" Height="20"  VerticalAlignment="Top" Width="20" Visibility="Hidden" Canvas.Left="314" Canvas.Top="157" Background="White" BorderBrush="#2D8CF0" BorderThickness="2"  DragDelta="RectRightUp_DragDelta" DragStarted="RectRightUp_DragStarted" DragCompleted="RectRightUp_DragCompleted"/>
327
-                                        <Thumb x:Name="RectRightUp" Cursor="SizeNESW"  HorizontalAlignment="Left" Height="20"  VerticalAlignment="Top" Width="20" Visibility="Hidden" Canvas.Left="775" Canvas.Top="157" Background="White" BorderBrush="#2D8CF0" BorderThickness="2" DragDelta="RectRightUp_DragDelta" DragStarted="RectRightUp_DragStarted" DragCompleted="RectRightUp_DragCompleted"/>
328
-                                        <Thumb x:Name="RectLeftDown" Cursor="SizeNESW"  HorizontalAlignment="Left" Height="20"  VerticalAlignment="Top" Width="20" Visibility="Hidden" Canvas.Left="314" Canvas.Top="508" Background="White" BorderBrush="#2D8CF0" BorderThickness="2" DragDelta="RectRightUp_DragDelta" DragStarted="RectRightUp_DragStarted" DragCompleted="RectRightUp_DragCompleted"/>
329
-                                        <Thumb x:Name="RectRightDown" Cursor="SizeNWSE"  HorizontalAlignment="Left" Height="20"  VerticalAlignment="Top" Width="20" Visibility="Hidden" Canvas.Left="775" Canvas.Top="508" Background="White" BorderBrush="#2D8CF0" BorderThickness="2" DragDelta="RectRightUp_DragDelta" DragStarted="RectRightUp_DragStarted" DragCompleted="RectRightUp_DragCompleted"/>
330
-                                    </Canvas>
331
-                                </Grid>
332
-                            </Border>
333
-                        </Grid>
334
-                        <Image x:Name="imgDocumentation" Visibility="Visible" VerticalAlignment="Top" Stretch="Fill"/>
335
-                        <Image x:Name="imgPPT" Visibility="Visible" VerticalAlignment="Top"/>
336
-                        <!--导入图片-->
337
-                        <!--<Button Cursor="Hand" x:Name="btnOk" Height="50" Width="50" Content="√" FontSize="26" Background="#2E8CF0" Foreground="#FFFFFF" Click="btnOk_Click" Visibility="Collapsed"/>-->
338
-                        <InkCanvas Grid.Row="0" x:Name="blackboard_canvas"  Background="Transparent" Visibility="Collapsed" Grid.ColumnSpan="2"/>
339
-                        <!--摄像头-->
340
-                        <!--<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">
321
+                                        <!--图片表框 -->
322
+                                        <Rectangle x:Name="RectImgBorder" Cursor="SizeAll" Fill="#00000000" HorizontalAlignment="Left" Stroke="#2D8CF0" VerticalAlignment="Top" Width="300" Height="300" Visibility="Hidden" Margin="373,175,0,0" StrokeThickness="4" StrokeDashArray="4 4" SnapsToDevicePixels="True"/>
323
+                                        <Image Name="imgCanvas" Height="0" VerticalAlignment="Top" HorizontalAlignment="Left" Stretch="Fill" MouseDown="PicEMap_MouseDown" RenderTransform="{StaticResource Imageview}" MouseRightButtonDown="imgCanvas_MouseRightButtonDown" MouseLeftButtonDown="imgCanvas_MouseLeftButtonDown" Focusable="True" MouseMove="imgCanvas_MouseMove" MouseUp="imgCanvas_MouseUp"/>
324
+                                        <!--四个点 -->
325
+                                        <Canvas>
326
+                                            <Thumb x:Name="RectLeftUp" Cursor="SizeNWSE"  HorizontalAlignment="Left" Height="20"  VerticalAlignment="Top" Width="20" Visibility="Hidden" Canvas.Left="314" Canvas.Top="157" Background="White" BorderBrush="#2D8CF0" BorderThickness="2"  DragDelta="RectRightUp_DragDelta" DragStarted="RectRightUp_DragStarted" DragCompleted="RectRightUp_DragCompleted"/>
327
+                                            <Thumb x:Name="RectRightUp" Cursor="SizeNESW"  HorizontalAlignment="Left" Height="20"  VerticalAlignment="Top" Width="20" Visibility="Hidden" Canvas.Left="775" Canvas.Top="157" Background="White" BorderBrush="#2D8CF0" BorderThickness="2" DragDelta="RectRightUp_DragDelta" DragStarted="RectRightUp_DragStarted" DragCompleted="RectRightUp_DragCompleted"/>
328
+                                            <Thumb x:Name="RectLeftDown" Cursor="SizeNESW"  HorizontalAlignment="Left" Height="20"  VerticalAlignment="Top" Width="20" Visibility="Hidden" Canvas.Left="314" Canvas.Top="508" Background="White" BorderBrush="#2D8CF0" BorderThickness="2" DragDelta="RectRightUp_DragDelta" DragStarted="RectRightUp_DragStarted" DragCompleted="RectRightUp_DragCompleted"/>
329
+                                            <Thumb x:Name="RectRightDown" Cursor="SizeNWSE"  HorizontalAlignment="Left" Height="20"  VerticalAlignment="Top" Width="20" Visibility="Hidden" Canvas.Left="775" Canvas.Top="508" Background="White" BorderBrush="#2D8CF0" BorderThickness="2" DragDelta="RectRightUp_DragDelta" DragStarted="RectRightUp_DragStarted" DragCompleted="RectRightUp_DragCompleted"/>
330
+                                        </Canvas>
331
+                                    </Grid>
332
+                                </Border>
333
+                            </Grid>
334
+                            <Image x:Name="imgDocumentation" Visibility="Visible" VerticalAlignment="Top" Stretch="Fill"/>
335
+                            <Image x:Name="imgPPT" Visibility="Visible" VerticalAlignment="Top"/>
336
+                            <!--导入图片-->
337
+                            <!--<Button Cursor="Hand" x:Name="btnOk" Height="50" Width="50" Content="√" FontSize="26" Background="#2E8CF0" Foreground="#FFFFFF" Click="btnOk_Click" Visibility="Collapsed"/>-->
338
+                            <InkCanvas Grid.Row="0" x:Name="blackboard_canvas"  Background="Transparent" Visibility="Collapsed" Grid.ColumnSpan="2"/>
339
+                            <!--摄像头-->
340
+                            <!--<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">
341 341
                     <aforge:VideoSourcePlayer x:Name="player" Height="124" Width="172"  />
342 342
                 </wfi:WindowsFormsHost>-->
343
-                        <!--<Image x:Name="imgLoad"
343
+                            <!--<Image x:Name="imgLoad"
344 344
                     Width="300"
345 345
                     Height="300"
346 346
                     gifLib:ImageBehavior.AnimatedSource="./Images/img_load.gif" VerticalAlignment="Top" Margin="0,200,0,0" Visibility="Visible"/>-->
347
-                    </Grid>
348
-                </ScrollViewer>
349
-                <Image x:Name="imgPlayerLeft" Width="172" Height="124" Source="./Images/microLessonSystem_17.png"  HorizontalAlignment="Left"  Margin="10,7,10,10" VerticalAlignment="Top" Visibility="Collapsed"/>
350
-                <Image x:Name="imgPlayerRight" Width="172" Height="124" Source="./Images/microLessonSystem_17.png"  HorizontalAlignment="Right"  Margin="10,7,26,10" VerticalAlignment="Top" Visibility="Collapsed"/>
351
-                <Image x:Name="imgPlayerLeftUnder" Width="172" Height="124" Source="./Images/microLessonSystem_17.png"  HorizontalAlignment="Left"  Margin="10,7,10,10" VerticalAlignment="Bottom" Visibility="Collapsed"/>
352
-                <Image x:Name="imgPlayerRightUnder" Width="172" Height="124" Source="./Images/microLessonSystem_17.png"  HorizontalAlignment="Right" Margin="10,7,26,10" VerticalAlignment="Bottom" Visibility="Collapsed"/>
353
-                <Label Content="" Grid.Column="0" Height="2" Width="2" HorizontalAlignment="Left"  VerticalAlignment="Top" Background="#FF0F0F0F" Margin="1,0,0,0"/>
354
-                <Label Content="" Grid.Column="1" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,16,0"/>
355
-                <Label Content="" Grid.Column="0" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="1,0,0,0"/>
356
-                <Label Content="" Grid.Column="1" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,16,0"/>
357
-                <!--<TextBlock x:Name="txbTime" Text="123456" FontSize="20" Foreground="#000000" Margin="0,0,0,10" HorizontalAlignment="Left" VerticalAlignment="Bottom"/>-->
358
-            </Grid>
347
+                        </Grid>
348
+                    </ScrollViewer>
349
+                    <Image x:Name="imgPlayerLeft" Width="172" Height="124" Source="./Images/microLessonSystem_17.png"  HorizontalAlignment="Left"  Margin="10,7,10,10" VerticalAlignment="Top" Visibility="Collapsed"/>
350
+                    <Image x:Name="imgPlayerRight" Width="172" Height="124" Source="./Images/microLessonSystem_17.png"  HorizontalAlignment="Right"  Margin="10,7,26,10" VerticalAlignment="Top" Visibility="Collapsed"/>
351
+                    <Image x:Name="imgPlayerLeftUnder" Width="172" Height="124" Source="./Images/microLessonSystem_17.png"  HorizontalAlignment="Left"  Margin="10,7,10,10" VerticalAlignment="Bottom" Visibility="Collapsed"/>
352
+                    <Image x:Name="imgPlayerRightUnder" Width="172" Height="124" Source="./Images/microLessonSystem_17.png"  HorizontalAlignment="Right" Margin="10,7,26,10" VerticalAlignment="Bottom" Visibility="Collapsed"/>
353
+                    <Label Content="" Grid.Column="0" Height="2" Width="2" HorizontalAlignment="Left"  VerticalAlignment="Top" Background="#FF0F0F0F" Margin="1,0,0,0"/>
354
+                    <Label Content="" Grid.Column="1" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,16,0"/>
355
+                    <Label Content="" Grid.Column="0" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="1,0,0,0"/>
356
+                    <Label Content="" Grid.Column="1" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,16,0"/>
357
+                    <!--<TextBlock x:Name="txbTime" Text="123456" FontSize="20" Foreground="#000000" Margin="0,0,0,10" HorizontalAlignment="Left" VerticalAlignment="Bottom"/>-->
358
+                </Grid>
359 359
             </Border>
360
-            <!--页码-->
361
-            <Grid Grid.Row="1" x:Name="gridPage" Visibility="Collapsed" MouseLeftButtonDown="Window_MouseLeftButtonDown_1">
362
-                <StackPanel Grid.Row="0" Orientation="Horizontal" Background="Transparent" Width="180" HorizontalAlignment="Center" Height="30" Margin="0,0,0,0" Grid.Column="1" VerticalAlignment="Bottom">
363
-                    <Button Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
364
-                    x:Name="last_button"
365
-                    Width="60" Height="20"
366
-                    Click="last_button_Click">
367
-
368
-                        <Button.Content>
369
-                            <StackPanel>
370
-                                <Image Width="16" Height="12" Source=".\Images\class_p1.png" />
371
-                            </StackPanel>
372
-                        </Button.Content>
373
-                    </Button>
374
-                    <Grid Width="60"  Background="Transparent" MouseLeftButtonDown="Window_MouseLeftButtonDown_1">
375
-                        <Grid.RowDefinitions>
376
-                            <RowDefinition Height="311*"/>
377
-                            <RowDefinition Height="483*"/>
378
-                        </Grid.RowDefinitions>
379
-                        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,-12,0,0" Grid.Row="1"  Background="Transparent">
380
-                            <StackPanel HorizontalAlignment="Center" Orientation="Horizontal"  Background="Transparent">
381
-                                <TextBlock x:Name="txbCurrpage" Text="{Binding currpage}" TextAlignment="Center" FontSize="15"/>
382
-                                <TextBlock Text="/" TextAlignment="Center" FontSize="15"/>
383
-                                <TextBlock Text="{Binding pagenum}" TextAlignment="Center" FontSize="15"/>
384
-                            </StackPanel>
385
-                        </StackPanel>
386
-                    </Grid>
387
-                    <Button Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
388
-                    x:Name="next_btn"  Background="Transparent"
389
-                    Width="60" Height="20"
390
-                    Click="next_btn_Click">
391
-                        <Button.Content>
392
-                            <StackPanel>
393
-                                <Image Width="16" Height="12" Source=".\Images\class_p2.png" />
394
-                            </StackPanel>
395
-                        </Button.Content>
396
-                    </Button>
397
-                </StackPanel>
398
-            </Grid>
399 360
             <!--设置-->
400 361
             <ScrollViewer x:Name="gridSetUp" Grid.Row="1" VerticalScrollBarVisibility="Auto" Visibility="Collapsed">
401 362
                 <Grid Grid.Row="1"   Background="#FFFFFF" >
@@ -499,7 +460,7 @@
499 460
                         <TextBlock Text="河南星火燎原软件科技有限公司" FontSize="14" Foreground="#333333"/>
500 461
                     </StackPanel>
501 462
 
502
-                    
463
+
503 464
                     <!--第四行 开始按钮-->
504 465
                     <Button Cursor="Hand" Grid.Row="10" Grid.ColumnSpan="2" x:Name="btnSave" Content="保存" FontSize="18" Foreground="#FFFFFF" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Width="115" Height="45" Margin="10,10,10,10" Click="BtnSave_Click">
505 466
                         <Button.Template>
@@ -670,13 +631,51 @@
670 631
                     <RadioButton Cursor="Hand" x:Name="rbnFine" Content=" 细" Style="{StaticResource radBase}" FontSize="14" Margin="0,4,0,0" IsChecked="True" Click="RbnFine_Click"/>
671 632
                     <RadioButton Cursor="Hand" x:Name="rbnIn" Content=" 中" Style="{StaticResource radBase}" FontSize="14" Margin="5,4,0,0" Click="RbnIn_Click"/>
672 633
                     <RadioButton Cursor="Hand" x:Name="rbnCrude" Content=" 粗" Style="{StaticResource radBase}" FontSize="14" Margin="5,4,0,0" Click="RbnCrude_Click"/>
673
-                    <StackPanel Orientation="Horizontal">
674
-                        <TextBlock Text="摄像头:" FontSize="14" Padding="20,3,0,0"/>
675
-                        <RadioButton Cursor="Hand" x:Name="rbnOpen" Content=" 开" Style="{StaticResource radBase}" FontSize="14" Margin="0,4,0,0" Click="RbnOpen_Click"/>
676
-                        <RadioButton Cursor="Hand" x:Name="rbnTurnOff" Content=" 关" Style="{StaticResource radBase}" FontSize="14" Margin="5,4,0,0" IsChecked="True" Click="RbnTurnOff_Click"/>
677
-                    </StackPanel>
678 634
                 </StackPanel>
635
+                <!--页码-->
636
+                <Grid Grid.Row="1" x:Name="gridPage" Visibility="Collapsed" MouseLeftButtonDown="Window_MouseLeftButtonDown_1" HorizontalAlignment="Center">
637
+                    <StackPanel Grid.Row="0" Orientation="Horizontal" Background="Transparent" Width="180" HorizontalAlignment="Center" Height="30" Margin="0,0,0,0" Grid.Column="1" VerticalAlignment="Bottom">
638
+                        <Button Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
639
+                    x:Name="last_button"
640
+                    Width="60" Height="20"
641
+                    Click="last_button_Click">
642
+
643
+                            <Button.Content>
644
+                                <StackPanel>
645
+                                    <Image Width="16" Height="12" Source=".\Images\class_p1.png" />
646
+                                </StackPanel>
647
+                            </Button.Content>
648
+                        </Button>
649
+                        <Grid Width="60"  Background="Transparent" MouseLeftButtonDown="Window_MouseLeftButtonDown_1">
650
+                            <Grid.RowDefinitions>
651
+                                <RowDefinition Height="311*"/>
652
+                                <RowDefinition Height="483*"/>
653
+                            </Grid.RowDefinitions>
654
+                            <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,-12,0,0" Grid.Row="1"  Background="Transparent">
655
+                                <StackPanel HorizontalAlignment="Center" Orientation="Horizontal"  Background="Transparent">
656
+                                    <TextBlock x:Name="txbCurrpage" Text="{Binding currpage}" TextAlignment="Center" FontSize="15"/>
657
+                                    <TextBlock Text="/" TextAlignment="Center" FontSize="15"/>
658
+                                    <TextBlock Text="{Binding pagenum}" TextAlignment="Center" FontSize="15"/>
659
+                                </StackPanel>
660
+                            </StackPanel>
661
+                        </Grid>
662
+                        <Button Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
663
+                    x:Name="next_btn"  Background="Transparent"
664
+                    Width="60" Height="20"
665
+                    Click="next_btn_Click">
666
+                            <Button.Content>
667
+                                <StackPanel>
668
+                                    <Image Width="16" Height="12" Source=".\Images\class_p2.png" />
669
+                                </StackPanel>
670
+                            </Button.Content>
671
+                        </Button>
672
+                    </StackPanel>
673
+                </Grid>
674
+
679 675
                 <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,5,10,5">
676
+                    <TextBlock Text="摄像头:" FontSize="14" Padding="20,3,0,0"/>
677
+                    <RadioButton Cursor="Hand" x:Name="rbnOpen" Content=" 开" Style="{StaticResource radBase}" FontSize="14" Margin="0,4,0,0" Click="RbnOpen_Click"/>
678
+                    <RadioButton Cursor="Hand" x:Name="rbnTurnOff" Content=" 关"  Style="{StaticResource radBase}" FontSize="14" Margin="5,4,20,0" IsChecked="True" Click="RbnTurnOff_Click"/>
680 679
                     <TextBlock Text="智能笔状态:" FontSize="14" Padding="0,4,0,0"/>
681 680
                     <TextBlock x:Name="txbNotConnected" Text="未连接" FontSize="14" Padding="0,4,5,0"/>
682 681
                 </StackPanel>

+ 424
- 364
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs
File diff suppressed because it is too large
View File


Loading…
Cancel
Save