|
@@ -28,6 +28,8 @@ using System.Diagnostics;
|
28
|
28
|
using System.Runtime.InteropServices;
|
29
|
29
|
using System.Windows.Controls.Primitives;
|
30
|
30
|
using System.Drawing;
|
|
31
|
+using System.Linq;
|
|
32
|
+
|
31
|
33
|
|
32
|
34
|
namespace XHWK.WKTool
|
33
|
35
|
{
|
|
@@ -109,17 +111,14 @@ namespace XHWK.WKTool
|
109
|
111
|
{
|
110
|
112
|
new Aspose.Pdf.License().SetLicense(new MemoryStream(Convert.FromBase64String("PExpY2Vuc2U+CiAgPERhdGE+CiAgICA8TGljZW5zZWRUbz5TdXpob3UgQXVuYm94IFNvZnR3YXJlIENvLiwgTHRkLjwvTGljZW5zZWRUbz4KICAgIDxFbWFpbFRvPnNhbGVzQGF1bnRlYy5jb208L0VtYWlsVG8+CiAgICA8TGljZW5zZVR5cGU+RGV2ZWxvcGVyIE9FTTwvTGljZW5zZVR5cGU+CiAgICA8TGljZW5zZU5vdGU+TGltaXRlZCB0byAxIGRldmVsb3BlciwgdW5saW1pdGVkIHBoeXNpY2FsIGxvY2F0aW9uczwvTGljZW5zZU5vdGU+CiAgICA8T3JkZXJJRD4xOTA4MjYwODA3NTM8L09yZGVySUQ+CiAgICA8VXNlcklEPjEzNDk3NjAwNjwvVXNlcklEPgogICAgPE9FTT5UaGlzIGlzIGEgcmVkaXN0cmlidXRhYmxlIGxpY2Vuc2U8L09FTT4KICAgIDxQcm9kdWN0cz4KICAgICAgPFByb2R1Y3Q+QXNwb3NlLlRvdGFsIGZvciAuTkVUPC9Qcm9kdWN0PgogICAgPC9Qcm9kdWN0cz4KICAgIDxFZGl0aW9uVHlwZT5FbnRlcnByaXNlPC9FZGl0aW9uVHlwZT4KICAgIDxTZXJpYWxOdW1iZXI+M2U0NGRlMzAtZmNkMi00MTA2LWIzNWQtNDZjNmEzNzE1ZmMyPC9TZXJpYWxOdW1iZXI+CiAgICA8U3Vic2NyaXB0aW9uRXhwaXJ5PjIwMjAwODI3PC9TdWJzY3JpcHRpb25FeHBpcnk+CiAgICA8TGljZW5zZVZlcnNpb24+My4wPC9MaWNlbnNlVmVyc2lvbj4KICAgIDxMaWNlbnNlSW5zdHJ1Y3Rpb25zPmh0dHBzOi8vcHVyY2hhc2UuYXNwb3NlLmNvbS9wb2xpY2llcy91c2UtbGljZW5zZTwvTGljZW5zZUluc3RydWN0aW9ucz4KICA8L0RhdGE+CiAgPFNpZ25hdHVyZT53UGJtNUt3ZTYvRFZXWFNIY1o4d2FiVEFQQXlSR0pEOGI3L00zVkV4YWZpQnd5U2h3YWtrNGI5N2c2eGtnTjhtbUFGY3J0c0cwd1ZDcnp6MytVYk9iQjRYUndTZWxsTFdXeXNDL0haTDNpN01SMC9jZUFxaVZFOU0rWndOQkR4RnlRbE9uYTFQajhQMzhzR1grQ3ZsemJLZFZPZXk1S3A2dDN5c0dqYWtaL1E9PC9TaWduYXR1cmU+CjwvTGljZW5zZT4=")));
|
111
|
113
|
InitializeComponent();
|
112
|
|
- double proportion = 1036.0 / 1276.0;
|
113
|
|
- Width = proportion * (PrimaryScreen.ScaleScreenSize().Height - 40);
|
114
|
|
- Height =/*1276-*/ PrimaryScreen.ScaleScreenSize().Height - 40;
|
115
|
|
- GridContent.Width = Width;
|
116
|
|
- GridContent.Height = Width;
|
117
|
|
-
|
|
114
|
+ double proportion = 1036.0 / 1290.0;
|
|
115
|
+ Width = (PrimaryScreen.ScaleWorkingAreaSize.Height)/proportion-(BorderThickness.Left+ BorderThickness.Right) ;
|
|
116
|
+ Height = PrimaryScreen.ScaleWorkingAreaSize.Height-(BorderThickness.Top+BorderThickness.Bottom);
|
|
117
|
+ GridContent.Width = Width-14;
|
|
118
|
+ GridContent.Height = Height;
|
118
|
119
|
|
119
|
|
- double splProportion = 1036.0 / 1276.0;
|
|
120
|
+
|
120
|
121
|
|
121
|
|
- splOne.Height = 20;
|
122
|
|
- splTwo.Height = 40;
|
123
|
122
|
|
124
|
123
|
//GridMain.Height= PrimaryScreen.ScaleScreenSize().Height - 40;
|
125
|
124
|
|
|
@@ -2720,14 +2719,14 @@ namespace XHWK.WKTool
|
2720
|
2719
|
}
|
2721
|
2720
|
catch (Exception ex)
|
2722
|
2721
|
{
|
2723
|
|
- if(ex.Message.ToString().Equals("{\"The document appears to be corrupted and cannot be loaded.\"}"))
|
2724
|
|
- {
|
2725
|
|
- MessageWindow.Show("Word文件无效或者Word文件被加密!");
|
2726
|
|
- }
|
2727
|
|
- else
|
2728
|
|
- {
|
2729
|
|
- MessageWindow.Show("文档已打开,请关闭后重试!");
|
2730
|
|
- }
|
|
2722
|
+ //if(ex.Message.ToString().Equals("{\"The document appears to be corrupted and cannot be loaded.\"}"))
|
|
2723
|
+ //{
|
|
2724
|
+ // MessageWindow.Show("Word文件无效或者Word文件被加密!");
|
|
2725
|
+ //}
|
|
2726
|
+ //else
|
|
2727
|
+ //{
|
|
2728
|
+ MessageWindow.Show("该文件无法使用!");
|
|
2729
|
+ //}
|
2731
|
2730
|
LogHelper.WriteErrLog("【导入方法(ConvertWordToImage)】错误日志:" + ex.Message, ex);
|
2732
|
2731
|
}
|
2733
|
2732
|
return images;
|
|
@@ -3432,12 +3431,30 @@ namespace XHWK.WKTool
|
3432
|
3431
|
}
|
3433
|
3432
|
}
|
3434
|
3433
|
System.Drawing.PointF imgRightDown;
|
|
3434
|
+ /// <summary>
|
|
3435
|
+ /// 设置控件最上层
|
|
3436
|
+ /// </summary>
|
|
3437
|
+ /// <param name="element"></param>
|
|
3438
|
+ public void BringToFront(Thumb element)//图片置于最顶层显示
|
|
3439
|
+ {
|
|
3440
|
+ if (element == null) return;
|
|
3441
|
+
|
|
3442
|
+ Canvas parent = element.Parent as Canvas;
|
|
3443
|
+ if (parent == null) return;
|
|
3444
|
+ var maxZ = parent.Children.OfType<UIElement>()//linq语句,取Zindex的最大值
|
|
3445
|
+ .Where(x => x != element)
|
|
3446
|
+ .Select(x => Canvas.GetZIndex(x))
|
|
3447
|
+ .Max();
|
|
3448
|
+ Canvas.SetZIndex(element, maxZ + 1);
|
|
3449
|
+ }
|
3435
|
3450
|
private void RectRightUp_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e)
|
3436
|
3451
|
{
|
3437
|
3452
|
try
|
3438
|
3453
|
{
|
3439
|
3454
|
|
3440
|
3455
|
Thumb thu = (Thumb)sender;
|
|
3456
|
+ BringToFront(thu);
|
|
3457
|
+
|
3441
|
3458
|
imgRightDown = new System.Drawing.PointF((float)(imgCanvas.Margin.Left + imgCanvas.ActualWidth), (float)(imgCanvas.Margin.Top + imgCanvas.ActualHeight));
|
3442
|
3459
|
HideAngleBorder();
|
3443
|
3460
|
switch (thu.Name)
|
|
@@ -3475,36 +3492,152 @@ namespace XHWK.WKTool
|
3475
|
3492
|
double plut = Canvas.GetTop(RectLeftUp);
|
3476
|
3493
|
double prdl = Canvas.GetLeft(RectRightDown);
|
3477
|
3494
|
double prdt = Canvas.GetTop(RectRightDown);
|
3478
|
|
- if (prdl - plul > 50)
|
3479
|
|
- {
|
3480
|
|
- }
|
3481
|
|
- if (prdt - plut > 50)
|
3482
|
|
- {
|
3483
|
|
- }
|
3484
|
3495
|
#endregion
|
3485
|
|
-
|
3486
|
|
- Canvas.SetLeft(thu, Canvas.GetLeft(thu) + e.HorizontalChange);
|
3487
|
|
- Canvas.SetTop(thu, Canvas.GetTop(thu) + e.VerticalChange);
|
|
3496
|
+
|
|
3497
|
+ //Canvas.SetLeft(thu, Canvas.GetLeft(thu) + e.HorizontalChange);
|
|
3498
|
+ //Canvas.SetTop(thu, Canvas.GetTop(thu) + e.VerticalChange);
|
|
3499
|
+ double imgW = 0;
|
|
3500
|
+ double imgH = 0;
|
|
3501
|
+ double imgX = 0;
|
|
3502
|
+ double imgY = 0;
|
3488
|
3503
|
switch (thu.Name)
|
3489
|
3504
|
{
|
3490
|
3505
|
case "RectLeftUp":
|
3491
|
|
- imgCanvas.Width = imgRightDown.X - (Mouse.GetPosition(gridM).X);
|
3492
|
|
- imgCanvas.Height = imgRightDown.Y - (Mouse.GetPosition(gridM).Y);
|
3493
|
|
- imgCanvas.Margin = new Thickness(Mouse.GetPosition(gridM).X, Mouse.GetPosition(gridM).Y, 0, 0);
|
|
3506
|
+ #region 左上
|
|
3507
|
+ imgW = imgRightDown.X - (Mouse.GetPosition(gridM).X);
|
|
3508
|
+ imgH = imgRightDown.Y - (Mouse.GetPosition(gridM).Y);
|
|
3509
|
+ imgX = 0;
|
|
3510
|
+ imgY = 0;
|
|
3511
|
+ if (imgW < 50)
|
|
3512
|
+ {
|
|
3513
|
+ imgCanvas.Width = 50;
|
|
3514
|
+ imgX = imgCanvas.Margin.Left;
|
|
3515
|
+ Canvas.SetLeft(thu, Canvas.GetLeft(RectRightDown) - 50);
|
|
3516
|
+ }
|
|
3517
|
+ else
|
|
3518
|
+ {
|
|
3519
|
+ imgCanvas.Width = imgW;
|
|
3520
|
+ imgX = Mouse.GetPosition(gridM).X;
|
|
3521
|
+ Canvas.SetLeft(thu, Canvas.GetLeft(thu) + e.HorizontalChange);
|
|
3522
|
+ }
|
|
3523
|
+ if (imgH < 50)
|
|
3524
|
+ {
|
|
3525
|
+ imgCanvas.Height = 50;
|
|
3526
|
+ imgY = imgCanvas.Margin.Top;
|
|
3527
|
+ Canvas.SetTop(thu, Canvas.GetTop(RectRightDown) - 50);
|
|
3528
|
+ }
|
|
3529
|
+ else
|
|
3530
|
+ {
|
|
3531
|
+ imgCanvas.Height = imgH;
|
|
3532
|
+ imgY = Mouse.GetPosition(gridM).Y;
|
|
3533
|
+ Canvas.SetTop(thu, Canvas.GetTop(thu) + e.VerticalChange);
|
|
3534
|
+ }
|
|
3535
|
+ imgCanvas.Margin = new Thickness(imgX, imgY, 0, 0);
|
|
3536
|
+ #endregion
|
|
3537
|
+ //imgCanvas.Width = imgRightDown.X - (Mouse.GetPosition(gridM).X);
|
|
3538
|
+ //imgCanvas.Height = imgRightDown.Y - (Mouse.GetPosition(gridM).Y);
|
|
3539
|
+ //imgCanvas.Margin = new Thickness(Mouse.GetPosition(gridM).X, Mouse.GetPosition(gridM).Y, 0, 0);
|
3494
|
3540
|
break;
|
3495
|
3541
|
case "RectRightUp":
|
3496
|
|
- imgCanvas.Width = Mouse.GetPosition(gridM).X - imgCanvas.Margin.Left;
|
3497
|
|
- imgCanvas.Height = imgRightDown.Y - (Mouse.GetPosition(gridM).Y);
|
3498
|
|
- imgCanvas.Margin = new Thickness(imgCanvas.Margin.Left, Mouse.GetPosition(gridM).Y, 0, 0);
|
|
3542
|
+ #region 右上
|
|
3543
|
+ imgW = Mouse.GetPosition(gridM).X - imgCanvas.Margin.Left;
|
|
3544
|
+ imgH = imgRightDown.Y - (Mouse.GetPosition(gridM).Y);
|
|
3545
|
+ imgX = 0;
|
|
3546
|
+ imgY = 0;
|
|
3547
|
+ if (imgW < 50)
|
|
3548
|
+ {
|
|
3549
|
+ imgCanvas.Width = 50;
|
|
3550
|
+ imgX = imgCanvas.Margin.Left;
|
|
3551
|
+ Canvas.SetLeft(thu, Canvas.GetLeft(RectLeftUp) + 50);
|
|
3552
|
+ }
|
|
3553
|
+ else
|
|
3554
|
+ {
|
|
3555
|
+ imgCanvas.Width = imgW;
|
|
3556
|
+ imgX = imgCanvas.Margin.Left;
|
|
3557
|
+ Canvas.SetLeft(thu, Canvas.GetLeft(thu) + e.HorizontalChange);
|
|
3558
|
+ }
|
|
3559
|
+ if (imgH < 50)
|
|
3560
|
+ {
|
|
3561
|
+ imgCanvas.Height = 50;
|
|
3562
|
+ imgY = imgCanvas.Margin.Top;
|
|
3563
|
+ Canvas.SetTop(thu, Canvas.GetTop(RectRightDown) - 50);
|
|
3564
|
+ }
|
|
3565
|
+ else
|
|
3566
|
+ {
|
|
3567
|
+ imgCanvas.Height = imgH;
|
|
3568
|
+ imgY = Mouse.GetPosition(gridM).Y;
|
|
3569
|
+ Canvas.SetTop(thu, Canvas.GetTop(thu) + e.VerticalChange);
|
|
3570
|
+ }
|
|
3571
|
+ imgCanvas.Margin = new Thickness(imgX, imgY, 0, 0);
|
|
3572
|
+ //imgCanvas.Width = Mouse.GetPosition(gridM).X - imgCanvas.Margin.Left;
|
|
3573
|
+ //imgCanvas.Height = imgRightDown.Y - (Mouse.GetPosition(gridM).Y);
|
|
3574
|
+ //imgCanvas.Margin = new Thickness(imgCanvas.Margin.Left, Mouse.GetPosition(gridM).Y, 0, 0);
|
|
3575
|
+ #endregion
|
3499
|
3576
|
break;
|
3500
|
3577
|
case "RectLeftDown":
|
3501
|
|
- imgCanvas.Width = imgRightDown.X - (Mouse.GetPosition(gridM).X);
|
3502
|
|
- imgCanvas.Height = Mouse.GetPosition(gridM).Y - imgCanvas.Margin.Top;
|
3503
|
|
- imgCanvas.Margin = new Thickness(Mouse.GetPosition(gridM).X, imgCanvas.Margin.Top, 0, 0);
|
|
3578
|
+ #region 左下
|
|
3579
|
+ imgW = imgRightDown.X - (Mouse.GetPosition(gridM).X);
|
|
3580
|
+ imgH = Mouse.GetPosition(gridM).Y - imgCanvas.Margin.Top;
|
|
3581
|
+ imgX = 0;
|
|
3582
|
+ imgY = 0;
|
|
3583
|
+ if (imgW < 50)
|
|
3584
|
+ {
|
|
3585
|
+ imgCanvas.Width = 50;
|
|
3586
|
+ imgX = imgCanvas.Margin.Left;
|
|
3587
|
+ Canvas.SetLeft(thu, Canvas.GetLeft(RectRightDown) - 50);
|
|
3588
|
+ }
|
|
3589
|
+ else
|
|
3590
|
+ {
|
|
3591
|
+ imgCanvas.Width = imgW;
|
|
3592
|
+ imgX = Mouse.GetPosition(gridM).X;
|
|
3593
|
+ Canvas.SetLeft(thu, Canvas.GetLeft(thu) + e.HorizontalChange);
|
|
3594
|
+ }
|
|
3595
|
+ if (imgH < 50)
|
|
3596
|
+ {
|
|
3597
|
+ imgCanvas.Height = 50;
|
|
3598
|
+ imgY = imgCanvas.Margin.Top;
|
|
3599
|
+ Canvas.SetTop(thu, Canvas.GetTop(RectLeftUp) + 50);
|
|
3600
|
+ }
|
|
3601
|
+ else
|
|
3602
|
+ {
|
|
3603
|
+ imgCanvas.Height = imgH;
|
|
3604
|
+ imgY = imgCanvas.Margin.Top;
|
|
3605
|
+ Canvas.SetTop(thu, Canvas.GetTop(thu) + e.VerticalChange);
|
|
3606
|
+ }
|
|
3607
|
+ imgCanvas.Margin = new Thickness(imgX, imgY, 0, 0);
|
|
3608
|
+ //imgCanvas.Width = imgRightDown.X - (Mouse.GetPosition(gridM).X);
|
|
3609
|
+ //imgCanvas.Height = Mouse.GetPosition(gridM).Y - imgCanvas.Margin.Top;
|
|
3610
|
+ //imgCanvas.Margin = new Thickness(Mouse.GetPosition(gridM).X, imgCanvas.Margin.Top, 0, 0);
|
|
3611
|
+ #endregion
|
3504
|
3612
|
break;
|
3505
|
3613
|
case "RectRightDown":
|
3506
|
|
- imgCanvas.Width += e.HorizontalChange;
|
3507
|
|
- imgCanvas.Height += e.VerticalChange;
|
|
3614
|
+ #region 右下
|
|
3615
|
+ imgW = Mouse.GetPosition(gridM).X - imgCanvas.Margin.Left;
|
|
3616
|
+ imgH = Mouse.GetPosition(gridM).Y - imgCanvas.Margin.Top;
|
|
3617
|
+ if (imgW < 50)
|
|
3618
|
+ {
|
|
3619
|
+ imgCanvas.Width = 50;
|
|
3620
|
+ Canvas.SetLeft(thu, Canvas.GetLeft(RectLeftUp) + 50);
|
|
3621
|
+ }
|
|
3622
|
+ else
|
|
3623
|
+ {
|
|
3624
|
+ imgCanvas.Width = imgW;
|
|
3625
|
+ Canvas.SetLeft(thu, Canvas.GetLeft(thu) + e.HorizontalChange);
|
|
3626
|
+ }
|
|
3627
|
+ if (imgH < 50)
|
|
3628
|
+ {
|
|
3629
|
+ imgCanvas.Height = 50;
|
|
3630
|
+ Canvas.SetTop(thu, Canvas.GetTop(RectLeftUp) + 50);
|
|
3631
|
+ }
|
|
3632
|
+ else
|
|
3633
|
+ {
|
|
3634
|
+ imgCanvas.Height = imgH;
|
|
3635
|
+ Canvas.SetTop(thu, Canvas.GetTop(thu) + e.VerticalChange);
|
|
3636
|
+ }
|
|
3637
|
+ //imgCanvas.Margin = new Thickness(imgX, imgY, 0, 0);
|
|
3638
|
+ //imgCanvas.Width += e.HorizontalChange;
|
|
3639
|
+ //imgCanvas.Height += e.VerticalChange;
|
|
3640
|
+ #endregion
|
3508
|
3641
|
break;
|
3509
|
3642
|
default:
|
3510
|
3643
|
break;
|