Browse Source

截图位置

tags/录制修改前
zhangxueyang 4 years ago
parent
commit
5128ada768

+ 1
- 1
Common/system/FFMpeg.cs View File

@@ -90,7 +90,7 @@ namespace Common.system
90 90
             myProcess.StartInfo.FileName = FileToolsCommon.GetFileAbsolutePath(@"/ffmpeg/bin/ffmpeg.exe");   //ffmpeg.exe的绝对路径
91 91
             string SpeakerStr = "";
92 92
             string MicrophoneStr = "";
93
-            if (/*IsRecordSpeaker*/true)
93
+            if (IsRecordSpeaker)
94 94
             {
95 95
                 SpeakerStr = "-f dshow -i audio=\"virtual-audio-capturer\" ";
96 96
             }

+ 7
- 7
XHWK.Model/Model_DrawData.cs View File

@@ -16,9 +16,9 @@ namespace XHWK.Model
16 16
         private int _PageNum;
17 17
         private string _pageCode;
18 18
         private string _pageImagePath;
19
-        private TranslateTransform _ImageLocation;
20
-        private ScaleTransform _ImageSize;
21
-        private ScaleTransform _ImageSizes;
19
+        private TranslateTransform _ImageLocation=new TranslateTransform(0,0);
20
+        //private ScaleTransform _ImageSize = new ScaleTransform(0, 0);
21
+        private ScaleTransform _ImageSizes = new ScaleTransform(0, 0);
22 22
         private bool _IsImageLocation;
23 23
         //private string _PenColor;
24 24
         //private int _PenWigth;
@@ -41,10 +41,10 @@ namespace XHWK.Model
41 41
         /// 图片坐标
42 42
         /// </summary>
43 43
         public TranslateTransform ImageLocation { get => _ImageLocation; set => _ImageLocation = value; }
44
-        /// <summary>
45
-        /// 图片大小
46
-        /// </summary>
47
-        public ScaleTransform ImageSize { get => _ImageSize; set => _ImageSize = value; }
44
+        ///// <summary>
45
+        ///// 图片大小
46
+        ///// </summary>
47
+        //public ScaleTransform ImageSize { get => _ImageSize; set => _ImageSize = value; }
48 48
         /// <summary>
49 49
         /// PDF 图片路径
50 50
         /// </summary>

+ 1
- 1
XHWK.WKTool/XHMicroLessonSystemWindow.xaml View File

@@ -280,7 +280,7 @@
280 280
                                         </ScrollViewer>-->
281 281
                                     <!--图片表框 -->
282 282
                                     <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"/>
283
-                                    <Image Name="imgCanvas" Height="0" VerticalAlignment="Top" HorizontalAlignment="Left" Stretch="Fill" MouseDown="PicEMap_MouseDown" RenderTransform="{StaticResource Imageview}" MouseRightButtonDown="imgCanvas_MouseRightButtonDown" Focusable="True" MouseMove="imgCanvas_MouseMove" MouseUp="imgCanvas_MouseUp"/>
283
+                                    <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"/>
284 284
                                     <!--四个点 -->
285 285
                                     <Canvas>
286 286
                                         <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"/>

+ 95
- 40
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs View File

@@ -431,9 +431,9 @@ namespace XHWK.WKTool
431 431
                 gridSetUp.Visibility = Visibility.Visible;
432 432
                 gridUpload.Visibility = Visibility.Collapsed;
433 433
                 txbStoragePath.Content = APP.WKData.WkPath;
434
-                ImgRecord.Visibility = Visibility.Collapsed;//设置时不可录制
435
-                ImgRecordTwo.Visibility = Visibility.Visible;//设置时不可录制
436
-                BtnRecord.IsEnabled = false;//设置时不可录制
434
+                //ImgRecord.Visibility = Visibility.Collapsed;//设置时不可录制
435
+                //ImgRecordTwo.Visibility = Visibility.Visible;//设置时不可录制
436
+                //BtnRecord.IsEnabled = false;//设置时不可录制
437 437
                 ///  < !--摄像头位置 1.右上 2.左上 3.右下 4.左下-- >
438 438
                 if ("1".Equals(APP.CameraPosition))
439 439
                 {
@@ -809,10 +809,18 @@ namespace XHWK.WKTool
809 809
 
810 810
                         imgDocumentation.Source = null;
811 811
                         BitmapImage bitImg = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));
812
+                        mouseDown = false;
813
+                        APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation = new TranslateTransform();
814
+                        APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X = 0.1;
815
+                        APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y = 0.1;
816
+                        APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes = new ScaleTransform();
817
+                        APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX = 475;
818
+                        APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY = 538;
819
+
820
+                        APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = false;
812 821
                         imgCanvas.Source = bitImg;
813 822
                         imgCanvas.Width = bitImg.Width;
814 823
                         imgCanvas.Height = bitImg.Height;
815
-                        APP.PageDrawList[APP.pageData.currpage - 1].ImgDocumentation = false;
816 824
                         ImgPrint.Visibility = Visibility.Visible;//截图成功可打印
817 825
                         ImgPrintTwo.Visibility = Visibility.Collapsed;
818 826
                         btnPrint.IsEnabled = true;
@@ -2449,6 +2457,12 @@ namespace XHWK.WKTool
2449 2457
         {
2450 2458
             if (APP.pageData.currpage > 1)
2451 2459
             {
2460
+                mouseDown = false;
2461
+                HideAngleBorder();
2462
+                //if(!APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation)
2463
+                //{
2464
+                //    ImgWG();
2465
+                //}
2452 2466
                 APP.pageData.currpage -= 1;
2453 2467
                 myblackboard.changepage(APP.pageData.currpage - 1);
2454 2468
                 if (btnImport.IsEnabled == true)
@@ -2483,23 +2497,9 @@ namespace XHWK.WKTool
2483 2497
                             APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = false;
2484 2498
                             if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null && APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X > 0)
2485 2499
                             {
2486
-                                var group = IMG.FindResource("Imageview") as TransformGroup;
2487
-                                var transform = group.Children[1] as TranslateTransform;
2488
-                                #region 高低 缩放比例
2489
-                                if (APP.PageDrawList[APP.pageData.currpage - 1].ImageSize != null)
2490
-                                {
2491
-                                    var transform1 = group.Children[0] as ScaleTransform;
2492
-                                    transform1.ScaleX = APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleX;
2493
-                                    transform1.ScaleY = APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleY;
2494
-                                    imgCanvas.Width = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX;
2495
-                                    imgCanvas.Height = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY;
2496
-                                }
2497
-                                #endregion
2498
-                                #region XY轴
2499
-                                transform.X = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
2500
-                                transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
2501
-                                #endregion
2502 2500
                                 mouseDown = false;
2501
+                                ImgXY();
2502
+                              
2503 2503
                             }
2504 2504
                         }
2505 2505
                     }
@@ -2511,6 +2511,25 @@ namespace XHWK.WKTool
2511 2511
                 }
2512 2512
             }
2513 2513
         }
2514
+        private void ImgXY()
2515
+        {
2516
+            imgCanvas.Width = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX;
2517
+            imgCanvas.Height = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY;
2518
+
2519
+            imgCanvas.Margin = new Thickness(APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X, APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y, 0,0);
2520
+            //imgCanvas.Margin.Left= APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
2521
+            //transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
2522
+        }
2523
+        private void ImgWG()
2524
+        {
2525
+            mouseDown = false;
2526
+            APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation = new TranslateTransform();
2527
+            APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X = imgCanvas.Margin.Left;
2528
+            APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y = imgCanvas.Margin.Top;
2529
+            APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes = new ScaleTransform();
2530
+            APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX = imgCanvas.ActualWidth;
2531
+            APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY = imgCanvas.ActualHeight;
2532
+        }
2514 2533
         /// <summary>
2515 2534
         /// 下一页
2516 2535
         /// </summary>
@@ -2520,6 +2539,12 @@ namespace XHWK.WKTool
2520 2539
         {
2521 2540
             if (APP.pageData.currpage < APP.pageData.pagenum)
2522 2541
             {
2542
+                mouseDown = false;
2543
+                HideAngleBorder();
2544
+                //if (!APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation)
2545
+                //{
2546
+                //    ImgWG();
2547
+                //}
2523 2548
                 APP.pageData.currpage += 1;
2524 2549
                 myblackboard.changepage(APP.pageData.currpage - 1);
2525 2550
                 if (btnImport.IsEnabled == true)
@@ -2552,23 +2577,25 @@ namespace XHWK.WKTool
2552 2577
                             APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = false;
2553 2578
                             if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null && APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X > 0)
2554 2579
                             {
2555
-                                var group = IMG.FindResource("Imageview") as TransformGroup;
2556
-                                #region 高低 缩放比例
2557
-                                if (APP.PageDrawList[APP.pageData.currpage - 1].ImageSize != null)
2558
-                                {
2559
-                                    var transform1 = group.Children[0] as ScaleTransform;
2560
-                                    transform1.ScaleX = APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleX;
2561
-                                    transform1.ScaleY = APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleY;
2562
-                                    imgCanvas.Width = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX;
2563
-                                    imgCanvas.Height = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY;
2564
-                                }
2565
-                                #endregion
2566
-                                #region 坐标XY轴
2567
-                                var transform = group.Children[1] as TranslateTransform;
2568
-                                transform.X = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
2569
-                                transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
2570
-                                #endregion
2580
+                                //var group = IMG.FindResource("Imageview") as TransformGroup;
2581
+                                //#region 高低 缩放比例
2582
+                                //if (APP.PageDrawList[APP.pageData.currpage - 1].ImageSize != null)
2583
+                                //{
2584
+                                //    var transform1 = group.Children[0] as ScaleTransform;
2585
+                                //    transform1.ScaleX = APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleX;
2586
+                                //    transform1.ScaleY = APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleY;
2587
+                                //    imgCanvas.Width = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX;
2588
+                                //    imgCanvas.Height = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY;
2589
+                                //}
2590
+                                //#endregion
2591
+                                //#region 坐标XY轴
2592
+                                //var transform = group.Children[1] as TranslateTransform;
2593
+                                //transform.X = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
2594
+                                //transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
2595
+                                //#endregion
2571 2596
                                 mouseDown = false;
2597
+                                ImgXY();
2598
+                              
2572 2599
                             }
2573 2600
                         }
2574 2601
                     }
@@ -2806,9 +2833,9 @@ namespace XHWK.WKTool
2806 2833
 
2807 2834
             //Console.WriteLine("transform.ScaleX = " + transform.ScaleX + "; transform.ScaleY = " + transform.ScaleY);
2808 2835
 
2809
-            APP.PageDrawList[APP.pageData.currpage - 1].ImageSize = new ScaleTransform();
2810
-            APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleX = transform.ScaleX;
2811
-            APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleY = transform.ScaleY;
2836
+            //APP.PageDrawList[APP.pageData.currpage - 1].ImageSize = new ScaleTransform();
2837
+            //APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleX = transform.ScaleX;
2838
+            //APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleY = transform.ScaleY;
2812 2839
             APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation = new TranslateTransform();
2813 2840
             APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X = transform1.X;
2814 2841
             APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y = transform1.Y;
@@ -3359,22 +3386,34 @@ namespace XHWK.WKTool
3359 3386
         }
3360 3387
         private void imgCanvas_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
3361 3388
         {
3362
-            if (e.LeftButton == MouseButtonState.Pressed)
3389
+            if (e.LeftButton == MouseButtonState.Pressed&&mouseDown)
3363 3390
             {
3364 3391
                 System.Windows.Point point = e.GetPosition(imgCanvas);
3365 3392
                 imgCanvas.Margin = new Thickness(imgCanvas.Margin.Left + (point.X - initialPoint.X), imgCanvas.Margin.Top + (point.Y - initialPoint.Y), 0, 0);
3393
+                APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation = new TranslateTransform();
3394
+                APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X = imgCanvas.Margin.Left;
3395
+                APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y = imgCanvas.Margin.Top;
3396
+                APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes = new ScaleTransform();
3397
+                APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX = imgCanvas.ActualWidth;
3398
+                APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY = imgCanvas.ActualHeight;
3399
+        
3400
+                APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = false;
3366 3401
             }
3367 3402
         }
3368 3403
 
3369 3404
         private void imgCanvas_MouseUp(object sender, MouseButtonEventArgs e)
3370 3405
         {
3406
+            if(mouseDown)
3407
+            {
3371 3408
             ShowAngleBorder();
3409
+            }
3372 3410
         }
3373 3411
         System.Drawing.PointF imgRightDown;
3374 3412
         private void RectRightUp_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e)
3375 3413
         {
3376 3414
             try
3377 3415
             {
3416
+             
3378 3417
                 Thumb thu = (Thumb)sender;
3379 3418
                 imgRightDown = new System.Drawing.PointF((float)(imgCanvas.Margin.Left + imgCanvas.ActualWidth), (float)(imgCanvas.Margin.Top + imgCanvas.ActualHeight));
3380 3419
                 HideAngleBorder();
@@ -3405,6 +3444,8 @@ namespace XHWK.WKTool
3405 3444
         {
3406 3445
             try
3407 3446
             {
3447
+                if(mouseDown)
3448
+                { 
3408 3449
                 Thumb thu = (Thumb)sender;
3409 3450
                 #region 判断是否超出 暂无
3410 3451
                 double plul = Canvas.GetLeft(RectLeftUp);
@@ -3445,6 +3486,15 @@ namespace XHWK.WKTool
3445 3486
                     default:
3446 3487
                         break;
3447 3488
                 }
3489
+                APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation = new TranslateTransform();
3490
+                APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X = imgCanvas.Margin.Left;
3491
+                APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y = imgCanvas.Margin.Top;
3492
+                APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes = new ScaleTransform();
3493
+                APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX = imgCanvas.ActualWidth;
3494
+                APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY = imgCanvas.ActualHeight;
3495
+                    APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = false;
3496
+
3497
+                }
3448 3498
                 //lbl1.Content = imgCanvas.Margin.Left + "," + imgCanvas.Margin.Top;
3449 3499
                 //lbl2.Content = (imgCanvas.Margin.Left+ imgCanvas.Width) +"," + imgCanvas.Margin.Top;
3450 3500
                 //lbl3.Content = imgCanvas.Margin.Left + "," + (imgCanvas.Margin.Top+ imgCanvas.Height);
@@ -3485,5 +3535,10 @@ namespace XHWK.WKTool
3485 3535
 
3486 3536
         }
3487 3537
         #endregion
3538
+
3539
+        private void imgCanvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
3540
+        {
3541
+            mouseDown = true;
3542
+        }
3488 3543
     }
3489 3544
 }

+ 2
- 2
XHWK.WKTool/ZConfig.cs View File

@@ -13,9 +13,9 @@ namespace XHWK.WKTool.Config
13 13
         /// <summary>
14 14
         /// 当前版本号
15 15
         /// </summary>
16
-        public static int versionCode = 6;
16
+        public static int versionCode = 7;
17 17
 
18
-        public static string versionName = "1.0.5";
18
+        public static string versionName = "1.0.6";
19 19
 
20 20
         //接口地址
21 21
         public static string apiUrl = isDebug ? "http://schoolapitest.xhkjedu.com" : "http://schoolapi.xhkjedu.com";

Loading…
Cancel
Save