瀏覽代碼

优化

tags/录制修改前
zhangxueyang 4 年之前
父節點
當前提交
356f329ee8

+ 23
- 4
Common/system/BlackboardNew.cs 查看文件

@@ -333,7 +333,7 @@ namespace Common.system
333 333
         StylusPoint stylusPoint = new StylusPoint();
334 334
         Stroke stroke;
335 335
         bool isFirst = true;
336
-        //public void changepages(double _x, double _y, bool _new, Color _color, int _size)
336
+        //public void changepages(double _x, double _y, bool _new, Color _color, int _size, int i)
337 337
         //{
338 338
         //    if (_new)
339 339
         //    {
@@ -349,6 +349,15 @@ namespace Common.system
349 349
         //            stroke.DrawingAttributes = drawingAttributes;
350 350
         //            m_canvas.Strokes.Add(stroke);
351 351
         //            isFirst = true;
352
+
353
+        //            strokes_page_all[i].lines.Last().lines_curr.Add(stroke);
354
+        //            //int currCount = strokes_page_all[i].lines.Last().lines_curr.Count;
355
+        //            //if (currCount > 0)
356
+        //            //{
357
+        //            //    strokes_page_all[i].lines.Last().lines_curr[currCount - 1].add = stroke;
358
+        //            //}
359
+
360
+
352 361
         //        }
353 362
 
354 363
         //        stylusPoints = new StylusPointCollection();
@@ -372,12 +381,16 @@ namespace Common.system
372 381
         //        }
373 382
         //        else
374 383
         //        {
375
-        //            if(m_canvas.Strokes.Count)
376
-        //            stylusPoint.X = _x;
384
+        //            if (m_canvas.Strokes.Count>0)
385
+        //            {
386
+
387
+
388
+        //                stylusPoint.X = _x;
377 389
         //            stylusPoint.Y = _y;
378 390
         //            stylusPoints.Add(stylusPoint);
379 391
         //            stroke = new Stroke(stylusPoints);
380 392
         //            m_canvas.Strokes[m_canvas.Strokes.Count - 1].StylusPoints.Add(stylusPoints);
393
+        //            }
381 394
         //        }
382 395
         //    }
383 396
         //}
@@ -397,7 +410,7 @@ namespace Common.system
397 410
 
398 411
 
399 412
 
400
-        public void changepages(double _x, double _y, bool _new, Color _color, int _size,int i)
413
+        public void changepages(double _x, double _y, bool _new, Color _color, int _size, int i)
401 414
         {
402 415
             try
403 416
             {
@@ -418,6 +431,12 @@ namespace Common.system
418 431
 
419 432
                         m_canvas.Strokes.Add(stroke);
420 433
                         strokes_page_all[i].lines.Last().lines_curr.Add(stroke);
434
+
435
+                        //int currCount= strokes_page_all[i].lines.Last().lines_curr.Count;
436
+                        //if (currCount > 0)
437
+                        //{
438
+                        //    strokes_page_all[i].lines.Last().lines_curr[currCount - 1] = stroke;
439
+                        //}
421 440
                         stroke = null;
422 441
                     }
423 442
 

+ 4
- 4
XHWK.WKTool/App.cs 查看文件

@@ -127,10 +127,10 @@ namespace XHWK.WKTool
127 127
         /// 打印
128 128
         /// </summary>
129 129
         public static PrintWindow W_PrintWindow = null;
130
-        /// <summary>
131
-        /// 提示窗口
132
-        /// </summary>
133
-        public static PromptWindow W_PromptWindow = null;
130
+        ///// <summary>
131
+        ///// 提示窗口
132
+        ///// </summary>
133
+        //public static PromptWindow W_PromptWindow = null;
134 134
         #endregion
135 135
         #endregion
136 136
 

+ 4
- 4
XHWK.WKTool/XHMicroLessonSystemWindow.xaml 查看文件

@@ -159,10 +159,10 @@
159 159
                 <Image x:Name="imgPlayerRight" Width="172" Height="124" Source="./Images/microLessonSystem_17.png"  HorizontalAlignment="Right"  Margin="10,7,26,10" VerticalAlignment="Top" Visibility="Collapsed"/>
160 160
                 <Image x:Name="imgPlayerLeftUnder" Width="172" Height="124" Source="./Images/microLessonSystem_17.png"  HorizontalAlignment="Left"  Margin="10,7,10,10" VerticalAlignment="Bottom" Visibility="Collapsed"/>
161 161
                 <Image x:Name="imgPlayerRightUnder" Width="172" Height="124" Source="./Images/microLessonSystem_17.png"  HorizontalAlignment="Right" Margin="10,7,26,10" VerticalAlignment="Bottom" Visibility="Collapsed"/>
162
-                <Label Content="" Grid.Column="0" HorizontalAlignment="Left" Height="10" VerticalAlignment="Top" Width="10" Background="#FF0F0F0F" Margin="1,0,0,0"/>
163
-                <Label Content="" Grid.Column="1" Height="10" Width="10" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,16,0"/>
164
-                <Label Content="" Grid.Column="0" Height="10" Width="10" Background="#FF0F0F0F" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="1,0,0,0"/>
165
-                <Label Content="" Grid.Column="1" Height="10" Width="10" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,16,0"/>
162
+                <Label Content="" Grid.Column="0" Height="2" Width="2" HorizontalAlignment="Left"  VerticalAlignment="Top" Background="#FF0F0F0F" Margin="1,0,0,0"/>
163
+                <Label Content="" Grid.Column="1" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,0,16,0"/>
164
+                <Label Content="" Grid.Column="0" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="1,0,0,0"/>
165
+                <Label Content="" Grid.Column="1" Height="2" Width="2" Background="#FF0F0F0F" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0,0,16,0"/>
166 166
             </Grid>
167 167
            
168 168
             <Grid Grid.Row="1">

+ 85
- 122
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs 查看文件

@@ -188,7 +188,7 @@ namespace XHWK.WKTool
188 188
                         if (I > 10010)
189 189
                         {
190 190
                             long time = Timestamp();
191
-                        string imgPath= FileToolsCommon.GetFileAbsolutePath("Temp/imgplayer");
191
+                            string imgPath = FileToolsCommon.GetFileAbsolutePath("Temp/imgplayer");
192 192
                             //string FilePathName = ImgPath + RsImgName.Count + ".png";
193 193
                             string path = CameraHelper.CaptureImage(imgPath, time.ToString());
194 194
                             if (!string.IsNullOrWhiteSpace(path))
@@ -327,7 +327,7 @@ namespace XHWK.WKTool
327 327
                 Login();
328 328
                 return;
329 329
             }
330
-            if(APP.fileDirectoryWindow==null)
330
+            if (APP.fileDirectoryWindow == null)
331 331
             {
332 332
                 APP.fileDirectoryWindow = new FileDirectoryWindow();
333 333
                 //APP.fileDirectoryWindow.Topmost = true;
@@ -692,7 +692,7 @@ namespace XHWK.WKTool
692 692
             {
693 693
                 if (!string.IsNullOrWhiteSpace(APP.ImgPath) && File.Exists(APP.ImgPath))
694 694
                 {
695
-                    if(APP.pageData.currpage==0)
695
+                    if (APP.pageData.currpage == 0)
696 696
                     {
697 697
                         APP.pageData.pagenum += 1;
698 698
                         APP.pageData.currpage = APP.pageData.pagenum;
@@ -905,21 +905,21 @@ namespace XHWK.WKTool
905 905
                             string paths = AppDomain.CurrentDomain.BaseDirectory + "Temp\\";
906 906
                             string[] page = ConvertWordToImage(filepath, paths, "", 0, 0, null, 0).ToArray();
907 907
                             int num = 0;
908
-                            for (int i = 0+ APP.pageData.pagenum; i < page.Length+ APP.pageData.pagenum; i++)//给画板模型加图片路径
908
+                            for (int i = 0 + APP.pageData.pagenum; i < page.Length + APP.pageData.pagenum; i++)//给画板模型加图片路径
909 909
                             {
910
-                                if (APP.PageDrawList!=null&&APP.PageDrawList.Count > i)
910
+                                if (APP.PageDrawList != null && APP.PageDrawList.Count > i)
911 911
                                 {
912
-                                    APP.PageDrawList[i].PageImagePath = page[i- APP.pageData.pagenum]; //zxycs
913
-                                    APP.PageDrawList[i].PdfImagePath = page[i- APP.pageData.pagenum];
912
+                                    APP.PageDrawList[i].PageImagePath = page[i - APP.pageData.pagenum]; //zxycs
913
+                                    APP.PageDrawList[i].PdfImagePath = page[i - APP.pageData.pagenum];
914 914
                                     APP.PageDrawList[i].PageNum = i + 1;
915 915
                                     APP.PageDrawList[i].ImgDocumentation = true;
916 916
                                 }
917 917
                                 else
918 918
                                 {
919
-                                  
919
+
920 920
                                     Model_DrawData model_DrawData = new Model_DrawData();
921
-                                    model_DrawData.PageImagePath = page[i- APP.pageData.pagenum];
922
-                                    model_DrawData.PdfImagePath = page[i- APP.pageData.pagenum];
921
+                                    model_DrawData.PageImagePath = page[i - APP.pageData.pagenum];
922
+                                    model_DrawData.PdfImagePath = page[i - APP.pageData.pagenum];
923 923
                                     model_DrawData.PageNum = i + 1;
924 924
                                     model_DrawData.ImgDocumentation = true;
925 925
                                     APP.PageDrawList.Add(model_DrawData);
@@ -930,12 +930,12 @@ namespace XHWK.WKTool
930 930
                                 APP.SaveDraw();
931 931
                                 num++;
932 932
                             }
933
-                            if(num>0)
933
+                            if (num > 0)
934 934
                             {
935 935
                                 APP.pageData.currpage = APP.pageData.pagenum + 1;
936 936
                                 APP.pageData.pagenum += num;
937 937
                             }
938
-                            if (APP.pageData.currpage>0 && APP.pageData.currpage < APP.PageDrawList.Count)
938
+                            if (APP.pageData.currpage > 0 && APP.pageData.currpage < APP.PageDrawList.Count)
939 939
                             {
940 940
                                 imgDocumentation.Source = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));//给当前页面展示图片
941 941
                                 imgCanvas.Source = null;
@@ -1016,7 +1016,7 @@ namespace XHWK.WKTool
1016 1016
         /// <param name="e"></param>
1017 1017
         private void BtnRecord_Click(object sender, RoutedEventArgs e)
1018 1018
         {
1019
-            if(APP.pageData.currpage > 0)
1019
+            if (APP.pageData.currpage > 0)
1020 1020
             {
1021 1021
                 blackboard_canvas.Visibility = Visibility.Visible;
1022 1022
             }
@@ -1251,7 +1251,7 @@ namespace XHWK.WKTool
1251 1251
                 ImgSetUpTwo.Visibility = Visibility.Collapsed;
1252 1252
                 btnSetUp.IsEnabled = true;
1253 1253
 
1254
-                btnLoginType.IsEnabled = true; 
1254
+                btnLoginType.IsEnabled = true;
1255 1255
                 #endregion
1256 1256
 
1257 1257
                 IsSuspendR = true;
@@ -1327,40 +1327,32 @@ namespace XHWK.WKTool
1327 1327
         /// <param name="e"></param>
1328 1328
         private void BtnAdd_Click(object sender, RoutedEventArgs e)
1329 1329
         {
1330
-      //      RectangleF rectangleF = new RectangleF();
1331
-      //      rectangleF.Width = (float)APP.PageDrawList[0].ImageSizes.CenterX;
1332
-      //      rectangleF.Height = (float)APP.PageDrawList[0].ImageSizes.CenterY;
1333
-      //      rectangleF.X= (float)APP.PageDrawList[0].ImageLocation.X;
1334
-      //      rectangleF.Y = (float)APP.PageDrawList[0].ImageLocation.Y;
1335
-
1336
-      //      //CESHI 
1337
-      //bool isImg=    MergerImg(APP.PageDrawList[0].PageImagePath, @"G:\102H.jpg", rectangleF, out string errmsg);
1338
-
1339
-
1340
-
1341
-                if (APP.pageData.currpage>0)
1342
-                {
1343
-                    APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = true;
1344
-                }
1345
-                if(IsStartCount&& blackboard_canvas.Visibility == Visibility.Collapsed)
1346
-                {
1347
-                    blackboard_canvas.Visibility = Visibility.Visible;
1348
-                }
1349
-                APP.pageData.pagenum += 1;
1350
-                APP.pageData.currpage = APP.pageData.pagenum;
1351
-                myblackboard.changepage(APP.pageData.currpage - 1);
1352
-                ///清空页面图片UI
1353
-                imgCanvas.Source = null;
1330
+            if (APP.pageData.currpage > 0)
1331
+            {
1332
+                APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = true;
1333
+            }
1334
+            if (IsStartCount && blackboard_canvas.Visibility == Visibility.Collapsed)
1335
+            {
1336
+                blackboard_canvas.Visibility = Visibility.Visible;
1337
+            }
1338
+            APP.pageData.pagenum += 1;
1339
+            APP.pageData.currpage = APP.pageData.pagenum;
1340
+            myblackboard.changepage(APP.pageData.currpage - 1);
1341
+            ///清空页面图片UI
1342
+            imgCanvas.Source = null;
1354 1343
             imgDocumentation.Source = null;
1355
-                ///画板模型增加一页
1356
-                Model_DrawData model_DrawData = new Model_DrawData();
1357
-                model_DrawData.PageNum = APP.pageData.currpage;
1358
-                APP.PageDrawList.Add(model_DrawData);
1359
-                APP.SaveDraw();
1360
-            ///截图可用
1361
-            ImgScreenshot.Visibility = Visibility.Visible;
1362
-            ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1363
-            btnScreenshot.IsEnabled = true;
1344
+            ///画板模型增加一页
1345
+            Model_DrawData model_DrawData = new Model_DrawData();
1346
+            model_DrawData.PageNum = APP.pageData.currpage;
1347
+            APP.PageDrawList.Add(model_DrawData);
1348
+            APP.SaveDraw();
1349
+            if (btnImport.IsEnabled == true)
1350
+            {
1351
+                ///截图可用
1352
+                ImgScreenshot.Visibility = Visibility.Visible;
1353
+                ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1354
+                btnScreenshot.IsEnabled = true;
1355
+            }
1364 1356
         }
1365 1357
         /// <summary>
1366 1358
         /// 打印事件
@@ -1375,7 +1367,7 @@ namespace XHWK.WKTool
1375 1367
 
1376 1368
 
1377 1369
 
1378
-                    iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 25, 25, 25, 25);
1370
+                iTextSharp.text.Document document = new iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 25, 25, 25, 25);
1379 1371
                 //iTextSharp.text.Rectangle page = new iTextSharp.text.Rectangle(iTextSharp.text.PageSize.A4., 250f);//cs
1380 1372
                 ////设置纸张横向
1381 1373
                 //document.SetPageSize(iTextSharp.text.PageSize.A4.Rotate());
@@ -1390,7 +1382,7 @@ namespace XHWK.WKTool
1390 1382
                 {
1391 1383
                     long ii = Timestamp();
1392 1384
                     string directoryPath = AppDomain.CurrentDomain.BaseDirectory + "Temp\\";
1393
-                    string filePathOutPut = Path.Combine(directoryPath, string.Format("{0}{1}.jpg", ii, i));
1385
+                    string filePathOutPut = Path.Combine(directoryPath, string.Format("print{0}{1}.jpg", ii, i));
1394 1386
                     RectangleF rectangleFs = new RectangleF();
1395 1387
                     MergerImg("", filePathOutPut, rectangleFs, out string errmsg);
1396 1388
                     image = iTextSharp.text.Image.GetInstance(filePathOutPut);
@@ -1398,7 +1390,7 @@ namespace XHWK.WKTool
1398 1390
                     {
1399 1391
 
1400 1392
                     }
1401
-                    else if(APP.PageDrawList[i].ImgDocumentation==true)
1393
+                    else if (APP.PageDrawList[i].ImgDocumentation == true)
1402 1394
                     {
1403 1395
                         image = iTextSharp.text.Image.GetInstance(APP.PageDrawList[i].PageImagePath);
1404 1396
                     }
@@ -1413,7 +1405,7 @@ namespace XHWK.WKTool
1413 1405
 
1414 1406
                         string msg = string.Empty;
1415 1407
                         bool isImg = MergerImg(APP.PageDrawList[i].PageImagePath, filePathOutPut, rectangleF, out msg);
1416
-                        if(isImg)
1408
+                        if (isImg)
1417 1409
                         {
1418 1410
                             image = iTextSharp.text.Image.GetInstance(filePathOutPut);
1419 1411
                         }
@@ -1423,7 +1415,7 @@ namespace XHWK.WKTool
1423 1415
                         }
1424 1416
                     }
1425 1417
 
1426
-                   
1418
+
1427 1419
 
1428 1420
 
1429 1421
                     if (image.Height > iTextSharp.text.PageSize.A4.Height - 25)
@@ -1451,7 +1443,7 @@ namespace XHWK.WKTool
1451 1443
             }
1452 1444
 
1453 1445
 
1454
-         
1446
+
1455 1447
 
1456 1448
 
1457 1449
 
@@ -1474,9 +1466,9 @@ namespace XHWK.WKTool
1474 1466
                 //APP.W_PrintWindow.Topmost = true;
1475 1467
                 APP.W_PrintWindow.Owner = this;
1476 1468
             }
1477
-            if (APP.PageDrawList.Count > 0 && !string.IsNullOrWhiteSpace(APP.PageDrawList[0].PdfImagePath))
1469
+            if (APP.PageDrawList.Count > 0 && !string.IsNullOrWhiteSpace(APP.PageDrawList[0].PageImagePath))
1478 1470
             {
1479
-                APP.W_PrintWindow.Initialize(APP.PageDrawList[0].PdfImagePath);
1471
+                APP.W_PrintWindow.Initialize(APP.PageDrawList[0].PageImagePath);
1480 1472
             }
1481 1473
             else
1482 1474
             {
@@ -1509,28 +1501,15 @@ namespace XHWK.WKTool
1509 1501
         {
1510 1502
             if (APP.pageData.currpage > 1)
1511 1503
             {
1512
-                try
1513
-                {
1514
-                    Dispatcher.Invoke(() =>
1515
-                    {
1516
-                        string filePath = FileToolsCommon.GetFileAbsolutePath("/Data/" + APP.UserInfo.Username + "/pdfimagetemp/");
1517
-                        FileToolsCommon.CreateDirectory(filePath);
1518
-                        string filePathName = filePath + APP.pageData.currpage.ToString() + ".jpg";
1519
-                        ImageHelper.SaveUIToImage(GridMain, filePathName, (int)GridMain.ActualWidth, (int)GridMain.ActualHeight);
1520
-                        //ImgPDFPath[APP.pageData.currpage - 1] = filePathName;
1521
-                        APP.PageDrawList[APP.pageData.currpage - 1].PdfImagePath = filePathName;
1522
-                    });
1523
-                }
1524
-                catch (Exception ex)
1525
-                {
1526
-                    LogHelper.WriteErrLog("【XHMicroLessonSystemWindow】(last_button_Click)生成图片错误:" + ex.Message, ex);
1527
-                }
1528 1504
                 APP.pageData.currpage -= 1;
1529 1505
                 myblackboard.changepage(APP.pageData.currpage - 1);
1530
-                ///截图可用
1531
-                ImgScreenshot.Visibility = Visibility.Visible;
1532
-                ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1533
-                btnScreenshot.IsEnabled = true;
1506
+                if (btnImport.IsEnabled == true)
1507
+                {
1508
+                    ///截图可用
1509
+                    ImgScreenshot.Visibility = Visibility.Visible;
1510
+                    ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1511
+                    btnScreenshot.IsEnabled = true;
1512
+                }
1534 1513
                 if (APP.pageData.currpage <= APP.PageDrawList.Count)
1535 1514
                 {
1536 1515
                     if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null)
@@ -1558,6 +1537,7 @@ namespace XHWK.WKTool
1558 1537
                             {
1559 1538
                                 var group = IMG.FindResource("Imageview") as TransformGroup;
1560 1539
                                 var transform = group.Children[1] as TranslateTransform;
1540
+                                #region 高低 缩放比例
1561 1541
                                 if (APP.PageDrawList[APP.pageData.currpage - 1].ImageSize != null)
1562 1542
                                 {
1563 1543
                                     var transform1 = group.Children[0] as ScaleTransform;
@@ -1566,9 +1546,11 @@ namespace XHWK.WKTool
1566 1546
                                     imgCanvas.Width = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX;
1567 1547
                                     imgCanvas.Height = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY;
1568 1548
                                 }
1569
-                                //var position = e.GetPosition(img);
1549
+                                #endregion
1550
+                                #region XY轴
1570 1551
                                 transform.X = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
1571 1552
                                 transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
1553
+                                #endregion
1572 1554
                                 mouseDown = false;
1573 1555
                             }
1574 1556
                         }
@@ -1580,7 +1562,6 @@ namespace XHWK.WKTool
1580 1562
                     }
1581 1563
                 }
1582 1564
             }
1583
-
1584 1565
         }
1585 1566
         /// <summary>
1586 1567
         /// 下一页
@@ -1591,38 +1572,24 @@ namespace XHWK.WKTool
1591 1572
         {
1592 1573
             if (APP.pageData.currpage < APP.pageData.pagenum)
1593 1574
             {
1594
-                try
1595
-                {
1596
-                    Dispatcher.Invoke(() =>
1597
-                    {
1598
-                        string filePath = FileToolsCommon.GetFileAbsolutePath("/Data/" + APP.UserInfo.Username + "/pdfimagetemp/");
1599
-                        FileToolsCommon.CreateDirectory(filePath);
1600
-                        string filePathName = filePath + APP.pageData.currpage.ToString() + ".jpg";
1601
-                        ImageHelper.SaveUIToImage(GridMain, filePathName, (int)GridMain.ActualWidth, (int)GridMain.ActualHeight);
1602
-                        //ImgPDFPath[APP.pageData.currpage - 1] = filePathName;
1603
-                        APP.PageDrawList[APP.pageData.currpage - 1].PdfImagePath = filePathName;
1604
-                    });
1605
-                }
1606
-                catch (Exception ex)
1607
-                {
1608
-                    LogHelper.WriteErrLog("【XHMicroLessonSystemWindow】(next_btn_Click)生成图片错误:" + ex.Message, ex);
1609
-                }
1610 1575
                 APP.pageData.currpage += 1;
1611 1576
                 myblackboard.changepage(APP.pageData.currpage - 1);
1612
-                ///截图可用
1613
-                ImgScreenshot.Visibility = Visibility.Visible;
1614
-                ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1615
-                btnScreenshot.IsEnabled = true;
1577
+                if (btnImport.IsEnabled == true)
1578
+                {
1579
+                    ///截图可用
1580
+                    ImgScreenshot.Visibility = Visibility.Visible;
1581
+                    ImgScreenshotTwo.Visibility = Visibility.Collapsed;
1582
+                    btnScreenshot.IsEnabled = true;
1583
+                }
1616 1584
                 if (APP.pageData.currpage <= APP.PageDrawList.Count)
1617 1585
                 {
1618
-
1619 1586
                     if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null)
1620 1587
                     {
1621 1588
                         APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = true;
1622 1589
                     }
1623 1590
                     if (!string.IsNullOrWhiteSpace(txbCurrpage.Text) && APP.pageData.currpage <= APP.PageDrawList.Count && !string.IsNullOrWhiteSpace(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath))
1624 1591
                     {
1625
-                        if(APP.PageDrawList[APP.pageData.currpage - 1].ImgDocumentation)
1592
+                        if (APP.PageDrawList[APP.pageData.currpage - 1].ImgDocumentation)
1626 1593
                         {
1627 1594
                             imgCanvas.Source = null;
1628 1595
                             imgDocumentation.Source = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));
@@ -1632,14 +1599,13 @@ namespace XHWK.WKTool
1632 1599
                         }
1633 1600
                         else
1634 1601
                         {
1635
-                            //imgCanvas.Source = new BitmapImage(new Uri(APP.Paths[APP.pageData.currpage-1]));
1636 1602
                             imgDocumentation.Source = null;
1637
-
1638 1603
                             imgCanvas.Source = new BitmapImage(new Uri(APP.PageDrawList[APP.pageData.currpage - 1].PageImagePath));
1639 1604
                             APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = false;
1640 1605
                             if (APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation != null && APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X > 0)
1641 1606
                             {
1642 1607
                                 var group = IMG.FindResource("Imageview") as TransformGroup;
1608
+                                #region 高低 缩放比例
1643 1609
                                 if (APP.PageDrawList[APP.pageData.currpage - 1].ImageSize != null)
1644 1610
                                 {
1645 1611
                                     var transform1 = group.Children[0] as ScaleTransform;
@@ -1648,10 +1614,12 @@ namespace XHWK.WKTool
1648 1614
                                     imgCanvas.Width = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterX;
1649 1615
                                     imgCanvas.Height = APP.PageDrawList[APP.pageData.currpage - 1].ImageSizes.CenterY;
1650 1616
                                 }
1617
+                                #endregion
1618
+                                #region 坐标XY轴
1651 1619
                                 var transform = group.Children[1] as TranslateTransform;
1652
-                                //var position = e.GetPosition(img);
1653 1620
                                 transform.X = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.X;
1654 1621
                                 transform.Y = APP.PageDrawList[APP.pageData.currpage - 1].ImageLocation.Y;
1622
+                                #endregion
1655 1623
                                 mouseDown = false;
1656 1624
                             }
1657 1625
                         }
@@ -1662,10 +1630,6 @@ namespace XHWK.WKTool
1662 1630
                         imgDocumentation.Source = null;
1663 1631
                     }
1664 1632
                 }
1665
-                //if (!string.IsNullOrWhiteSpace(APP.JPaths[APP.pageData.currpage]))
1666
-                //{
1667
-                //    imgCanvas.Source = new BitmapImage(new Uri(APP.JPaths[APP.pageData.currpage]));
1668
-                //}
1669 1633
             }
1670 1634
         }
1671 1635
         /// <summary>
@@ -1676,45 +1640,45 @@ namespace XHWK.WKTool
1676 1640
         /// <param name="_rectangle">图片位置</param>
1677 1641
         /// <param name="errmsg">错误消息</param>
1678 1642
         /// <returns></returns>
1679
-        private bool MergerImg(string _path,string _saveimg,RectangleF _rectangle, out string errmsg)
1643
+        private bool MergerImg(string _path, string _saveimg, RectangleF _rectangle, out string errmsg)
1680 1644
         {
1681 1645
             errmsg = null;
1682 1646
             try
1683 1647
             {
1684 1648
                 Bitmap bitmap = null;
1685 1649
 
1686
-                 //创建要显示的图片对象,根据参数的个数设置宽度
1687
-                 Bitmap backgroudImg = new Bitmap((int)gridM.ActualWidth, (int)gridM.ActualHeight);
1650
+                //创建要显示的图片对象,根据参数的个数设置宽度
1651
+                Bitmap backgroudImg = new Bitmap((int)gridM.ActualWidth, (int)gridM.ActualHeight);
1688 1652
                 Graphics g = Graphics.FromImage(backgroudImg);
1689 1653
                 //清除画布,背景设置为白色
1690 1654
                 g.Clear(System.Drawing.Color.White);
1691 1655
 
1692
-                if(!string.IsNullOrWhiteSpace(_path))
1656
+                if (!string.IsNullOrWhiteSpace(_path))
1693 1657
                 {
1694
-                     bitmap = ImageHelper.ReadBitmapFile(_path);
1658
+                    bitmap = ImageHelper.ReadBitmapFile(_path);
1695 1659
                     g.DrawImage(bitmap, _rectangle);
1696 1660
                 }
1697 1661
 
1698 1662
 
1699 1663
                 backgroudImg.Save(_saveimg);
1700
-               
1664
+
1701 1665
                 g.Dispose();
1702 1666
                 backgroudImg.Dispose();
1703
-                if(bitmap!=null)
1667
+                if (bitmap != null)
1704 1668
                 {
1705 1669
                     bitmap.Dispose();
1706 1670
                 }
1707
-              
1671
+
1708 1672
                 GC.Collect();
1709 1673
                 return true;
1710 1674
             }
1711 1675
             catch (Exception ex)
1712 1676
             {
1713 1677
                 errmsg = ex.Message;
1714
-                LogHelper.WriteErrLog("【截图合成】(MergerImg)图片合成失败:" + ex.Message,ex);
1678
+                LogHelper.WriteErrLog("【截图合成】(MergerImg)图片合成失败:" + ex.Message, ex);
1715 1679
                 return false;
1716 1680
             }
1717
-        
1681
+
1718 1682
         }
1719 1683
         /// <summary>
1720 1684
         /// 将Word文档转换为图片的方法(该方法基于第三方DLL),你可以像这样调用该方法: ConvertPDF2Image("F:\\PdfFile.doc", "F:\\",
@@ -2097,15 +2061,14 @@ namespace XHWK.WKTool
2097 2061
                 //}
2098 2062
                 stroke.Clear();
2099 2063
             }
2100
-            if(APP.pageData.currpage>0)
2064
+            if (APP.pageData.currpage > 0)
2101 2065
             {
2102 2066
                 Dispatcher.Invoke(new Action(() =>
2103 2067
                 {
2104
-                    //myblackboard.changepages(0, 0, true);
2105 2068
                     myblackboard.changepages(0, 0, true, Color, Size, APP.pageData.currpage - 1);
2106 2069
                 }));
2107 2070
             }
2108
-         
2071
+
2109 2072
 
2110 2073
         }
2111 2074
 
@@ -2238,7 +2201,7 @@ namespace XHWK.WKTool
2238 2201
                 double testX = (double)cx * PropW;
2239 2202
                 double testY = (double)cy * PropH;
2240 2203
                 //pageSerial //点阵IP地址  与打印的页面关联
2241
-                if(APP.pageData.currpage>0)
2204
+                if (APP.pageData.currpage > 0)
2242 2205
                 {
2243 2206
                     Dispatcher.Invoke(new Action(() =>
2244 2207
                     {
@@ -2246,7 +2209,7 @@ namespace XHWK.WKTool
2246 2209
                         myblackboard.changepages(testX, testY, false, Color, Size, APP.pageData.currpage - 1);
2247 2210
                     }));
2248 2211
                 }
2249
-             
2212
+
2250 2213
 
2251 2214
 
2252 2215
                 ////每3个点画一条曲线
@@ -2330,7 +2293,7 @@ namespace XHWK.WKTool
2330 2293
         /// </summary>
2331 2294
         /// <param name="sender"></param>
2332 2295
         /// <param name="e"></param>
2333
-        private void BtnOk_Click(object sender, RoutedEventArgs e) 
2296
+        private void BtnOk_Click(object sender, RoutedEventArgs e)
2334 2297
         {
2335 2298
             //APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = true;
2336 2299
             //btnOk.Visibility = Visibility.Collapsed;

Loading…
取消
儲存