|
@@ -123,6 +123,7 @@ namespace XHWK.WKTool
|
123
|
123
|
private static extern int SetCursorPos(int x, int y);
|
124
|
124
|
|
125
|
125
|
private LuoBoPenUtil luoBoPenUtil;
|
|
126
|
+ private ImageOperationUtil imageOperationUtil;
|
126
|
127
|
|
127
|
128
|
/// <summary>
|
128
|
129
|
/// 主页面
|
|
@@ -174,6 +175,16 @@ namespace XHWK.WKTool
|
174
|
175
|
new Aspose.Words.License().SetLicense(new MemoryStream(license));
|
175
|
176
|
new Aspose.Pdf.License().SetLicense(new MemoryStream(license));
|
176
|
177
|
new Aspose.Slides.License().SetLicense(new MemoryStream(license));
|
|
178
|
+
|
|
179
|
+ imageOperationUtil = new ImageOperationUtil(
|
|
180
|
+ RectLeftUp,
|
|
181
|
+ RectRightUp,
|
|
182
|
+ RectLeftDown,
|
|
183
|
+ RectRightDown,
|
|
184
|
+ RectImgBorder,
|
|
185
|
+ imgCanvas,
|
|
186
|
+ GridM
|
|
187
|
+ );
|
177
|
188
|
}
|
178
|
189
|
|
179
|
190
|
/// <summary>
|
|
@@ -1281,6 +1292,7 @@ namespace XHWK.WKTool
|
1281
|
1292
|
private void imgCanvas_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
1282
|
1293
|
{
|
1283
|
1294
|
mouseDown = true;
|
|
1295
|
+ imageOperationUtil.setMouseDown(mouseDown);
|
1284
|
1296
|
}
|
1285
|
1297
|
|
1286
|
1298
|
#endregion 画笔
|
|
@@ -1415,6 +1427,7 @@ namespace XHWK.WKTool
|
1415
|
1427
|
imgDocumentation.Source = null;
|
1416
|
1428
|
BitmapImage bitImg = new BitmapImage(new Uri(APP.PageDrawList[APP.PageContextData.currpage - 1].PageImagePath));
|
1417
|
1429
|
mouseDown = false;
|
|
1430
|
+ imageOperationUtil.setMouseDown(mouseDown);
|
1418
|
1431
|
APP.PageDrawList[APP.PageContextData.currpage - 1].ImageLocation = new TranslateTransform
|
1419
|
1432
|
{
|
1420
|
1433
|
X = 0.1,
|
|
@@ -1835,6 +1848,7 @@ namespace XHWK.WKTool
|
1835
|
1848
|
imgDocumentation.Source = null;
|
1836
|
1849
|
BitmapImage bitImg = new BitmapImage(new Uri(APP.PageDrawList[APP.PageContextData.currpage - 1].PageImagePath));
|
1837
|
1850
|
mouseDown = false;
|
|
1851
|
+ imageOperationUtil.setMouseDown(mouseDown);
|
1838
|
1852
|
APP.PageDrawList[APP.PageContextData.currpage - 1].ImageLocation = new TranslateTransform
|
1839
|
1853
|
{
|
1840
|
1854
|
X = 0.1,
|
|
@@ -3276,6 +3290,7 @@ namespace XHWK.WKTool
|
3276
|
3290
|
if (APP.PageContextData.currpage > 1)
|
3277
|
3291
|
{
|
3278
|
3292
|
mouseDown = false;
|
|
3293
|
+ imageOperationUtil.setMouseDown(mouseDown);
|
3279
|
3294
|
HideAngleBorder();
|
3280
|
3295
|
|
3281
|
3296
|
APP.PageContextData.currpage -= 1;
|
|
@@ -3295,6 +3310,7 @@ namespace XHWK.WKTool
|
3295
|
3310
|
if (APP.PageContextData.currpage < APP.PageContextData.pagenum)
|
3296
|
3311
|
{
|
3297
|
3312
|
mouseDown = false;
|
|
3313
|
+ imageOperationUtil.setMouseDown(mouseDown);
|
3298
|
3314
|
HideAngleBorder();
|
3299
|
3315
|
|
3300
|
3316
|
APP.PageContextData.currpage += 1;
|
|
@@ -3348,6 +3364,7 @@ namespace XHWK.WKTool
|
3348
|
3364
|
if (APP.PageDrawList[APP.PageContextData.currpage - 1].ImageLocation != null && APP.PageDrawList[APP.PageContextData.currpage - 1].ImageLocation.X > 0)
|
3349
|
3365
|
{
|
3350
|
3366
|
mouseDown = false;
|
|
3367
|
+ imageOperationUtil.setMouseDown(mouseDown);
|
3351
|
3368
|
ImgXY();
|
3352
|
3369
|
}
|
3353
|
3370
|
}
|
|
@@ -3385,6 +3402,7 @@ namespace XHWK.WKTool
|
3385
|
3402
|
}
|
3386
|
3403
|
img.CaptureMouse();
|
3387
|
3404
|
mouseDown = true;
|
|
3405
|
+ imageOperationUtil.setMouseDown(mouseDown);
|
3388
|
3406
|
mouseXY = e.GetPosition(img);
|
3389
|
3407
|
//Console.WriteLine("mouseXY.X = " + mouseXY.X + "; mouseXY.Y = " + mouseXY.Y);
|
3390
|
3408
|
}
|
|
@@ -3398,6 +3416,7 @@ namespace XHWK.WKTool
|
3398
|
3416
|
}
|
3399
|
3417
|
img.ReleaseMouseCapture();
|
3400
|
3418
|
mouseDown = false;
|
|
3419
|
+ imageOperationUtil.setMouseDown(mouseDown);
|
3401
|
3420
|
}
|
3402
|
3421
|
|
3403
|
3422
|
private void IMG1_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
|
|
@@ -3441,7 +3460,6 @@ namespace XHWK.WKTool
|
3441
|
3460
|
X = transform.X,
|
3442
|
3461
|
Y = transform.Y
|
3443
|
3462
|
};
|
3444
|
|
- //APP.PageDrawList[APP.pageData.currpage - 1].IsImageLocation = false;
|
3445
|
3463
|
}
|
3446
|
3464
|
|
3447
|
3465
|
private void IMG1_MouseWheel(object sender, MouseWheelEventArgs e)
|
|
@@ -3452,10 +3470,9 @@ namespace XHWK.WKTool
|
3452
|
3470
|
return;
|
3453
|
3471
|
}
|
3454
|
3472
|
System.Windows.Point point = e.GetPosition(img);
|
3455
|
|
- //Console.WriteLine("point.X = " + point.X + "; point.Y=" + point.Y);
|
|
3473
|
+
|
3456
|
3474
|
System.Windows.Point PicLocate = e.GetPosition(imgCanvas);
|
3457
|
|
- //Console.WriteLine("PicEmap.X = " + PicLocate.X + "; PicEmap.Y=" + PicLocate.Y);
|
3458
|
|
-
|
|
3475
|
+
|
3459
|
3476
|
TransformGroup group = IMG.FindResource("Imageview") as TransformGroup;
|
3460
|
3477
|
double delta = e.Delta * 0.001;
|
3461
|
3478
|
DowheelZoom(group, point, delta);
|
|
@@ -3475,15 +3492,7 @@ namespace XHWK.WKTool
|
3475
|
3492
|
TranslateTransform transform1 = group.Children[1] as TranslateTransform;
|
3476
|
3493
|
transform1.X = -1 * ((pointToContent.X * transform.ScaleX) - point.X);
|
3477
|
3494
|
transform1.Y = -1 * ((pointToContent.Y * transform.ScaleY) - point.Y);
|
3478
|
|
- //LogHelper.WriteInfoLog("【img宽高】" + imgCanvas.ActualWidth.ToString() + ":"
|
3479
|
|
- // + imgCanvas.ActualHeight.ToString() + "百分比:" + transform.ScaleX.ToString() + ":" + transform.ScaleY.ToString()
|
3480
|
|
- // );
|
3481
|
|
-
|
3482
|
|
- //Console.WriteLine("transform.ScaleX = " + transform.ScaleX + "; transform.ScaleY = " + transform.ScaleY);
|
3483
|
|
-
|
3484
|
|
- //APP.PageDrawList[APP.pageData.currpage - 1].ImageSize = new ScaleTransform();
|
3485
|
|
- //APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleX = transform.ScaleX;
|
3486
|
|
- //APP.PageDrawList[APP.pageData.currpage - 1].ImageSize.ScaleY = transform.ScaleY;
|
|
3495
|
+
|
3487
|
3496
|
APP.PageDrawList[APP.PageContextData.currpage - 1].ImageLocation = new TranslateTransform
|
3488
|
3497
|
{
|
3489
|
3498
|
X = transform1.X,
|
|
@@ -3695,358 +3704,43 @@ namespace XHWK.WKTool
|
3695
|
3704
|
|
3696
|
3705
|
#region 图片拉伸移动
|
3697
|
3706
|
|
3698
|
|
- private System.Windows.Point initialPoint;
|
3699
|
|
-
|
3700
|
3707
|
/// <summary>
|
3701
|
3708
|
/// 隐藏图片四个点和线
|
3702
|
3709
|
/// </summary>
|
3703
|
3710
|
private void HideAngleBorder()
|
3704
|
3711
|
{
|
3705
|
|
- RectLeftUp.Visibility = Visibility.Hidden;
|
3706
|
|
- RectRightUp.Visibility = Visibility.Hidden;
|
3707
|
|
- RectLeftDown.Visibility = Visibility.Hidden;
|
3708
|
|
- RectRightDown.Visibility = Visibility.Hidden;
|
3709
|
|
- RectImgBorder.Visibility = Visibility.Hidden;
|
3710
|
|
- }
|
3711
|
|
-
|
3712
|
|
- private void ShowAngleBorder()
|
3713
|
|
- {
|
3714
|
|
- PointLocation();
|
3715
|
|
- RectLeftUp.Visibility = Visibility.Visible;
|
3716
|
|
- RectRightUp.Visibility = Visibility.Visible;
|
3717
|
|
- RectLeftDown.Visibility = Visibility.Visible;
|
3718
|
|
- RectRightDown.Visibility = Visibility.Visible;
|
3719
|
|
- RectImgBorder.Visibility = Visibility.Visible;
|
3720
|
|
- }
|
3721
|
|
-
|
3722
|
|
- /// <summary>
|
3723
|
|
- /// 确定四个点和边框的位置大小
|
3724
|
|
- /// </summary>
|
3725
|
|
- private void PointLocation()
|
3726
|
|
- {
|
3727
|
|
- RectImgBorder.Width = imgCanvas.ActualWidth + 10.0;
|
3728
|
|
- RectImgBorder.Height = imgCanvas.ActualHeight + 10.0;
|
3729
|
|
- RectImgBorder.Margin = new Thickness(imgCanvas.Margin.Left - 5.0, imgCanvas.Margin.Top - 5.0, 0, 0);
|
3730
|
|
-
|
3731
|
|
- Canvas.SetLeft(RectLeftUp, imgCanvas.Margin.Left - 10.0);
|
3732
|
|
- Canvas.SetTop(RectLeftUp, imgCanvas.Margin.Top - 10.0);
|
3733
|
|
-
|
3734
|
|
- Canvas.SetLeft(RectRightUp, imgCanvas.Margin.Left + imgCanvas.ActualWidth - 10.0);
|
3735
|
|
- Canvas.SetTop(RectRightUp, imgCanvas.Margin.Top - 10.0);
|
3736
|
|
-
|
3737
|
|
- Canvas.SetLeft(RectLeftDown, imgCanvas.Margin.Left - 10.0);
|
3738
|
|
- Canvas.SetTop(RectLeftDown, imgCanvas.Margin.Top + imgCanvas.ActualHeight - 10.0);
|
3739
|
|
-
|
3740
|
|
- Canvas.SetLeft(RectRightDown, imgCanvas.Margin.Left + imgCanvas.ActualWidth - 10.0);
|
3741
|
|
- Canvas.SetTop(RectRightDown, imgCanvas.Margin.Top + imgCanvas.ActualHeight - 10.0);
|
|
3712
|
+ imageOperationUtil.HideAngleBorder();
|
3742
|
3713
|
}
|
3743
|
3714
|
|
|
3715
|
+
|
3744
|
3716
|
private void PicEMap_MouseDown(object sender, MouseButtonEventArgs e)
|
3745
|
3717
|
{
|
3746
|
|
- System.Windows.Point point = e.GetPosition(imgCanvas);
|
3747
|
|
- initialPoint = point;
|
3748
|
|
-
|
3749
|
|
- HideAngleBorder();
|
|
3718
|
+ imageOperationUtil.PicEMap_MouseDown(sender, e);
|
3750
|
3719
|
}
|
3751
|
3720
|
|
3752
|
3721
|
private void imgCanvas_MouseMove(object sender, MouseEventArgs e)
|
3753
|
3722
|
{
|
3754
|
|
- if (e.LeftButton == MouseButtonState.Pressed && mouseDown)
|
3755
|
|
- {
|
3756
|
|
- System.Windows.Point point = e.GetPosition(imgCanvas);
|
3757
|
|
- imgCanvas.Margin = new Thickness(imgCanvas.Margin.Left + (point.X - initialPoint.X), imgCanvas.Margin.Top + (point.Y - initialPoint.Y), 0, 0);
|
3758
|
|
- APP.PageDrawList[APP.PageContextData.currpage - 1].ImageLocation = new TranslateTransform
|
3759
|
|
- {
|
3760
|
|
- X = imgCanvas.Margin.Left,
|
3761
|
|
- Y = imgCanvas.Margin.Top
|
3762
|
|
- };
|
3763
|
|
- APP.PageDrawList[APP.PageContextData.currpage - 1].ImageSizes = new ScaleTransform
|
3764
|
|
- {
|
3765
|
|
- CenterX = imgCanvas.ActualWidth,
|
3766
|
|
- CenterY = imgCanvas.ActualHeight
|
3767
|
|
- };
|
3768
|
|
-
|
3769
|
|
- APP.PageDrawList[APP.PageContextData.currpage - 1].IsImageLocation = false;
|
3770
|
|
- }
|
|
3723
|
+ imageOperationUtil.imgCanvas_MouseMove(sender,e);
|
3771
|
3724
|
}
|
3772
|
3725
|
|
3773
|
3726
|
private void imgCanvas_MouseUp(object sender, MouseButtonEventArgs e)
|
3774
|
3727
|
{
|
3775
|
|
- if (mouseDown)
|
3776
|
|
- {
|
3777
|
|
- ShowAngleBorder();
|
3778
|
|
- }
|
3779
|
|
- }
|
3780
|
|
-
|
3781
|
|
- private PointF imgRightDown;
|
3782
|
|
-
|
3783
|
|
- /// <summary>
|
3784
|
|
- /// 设置控件最上层
|
3785
|
|
- /// </summary>
|
3786
|
|
- /// <param name="element">
|
3787
|
|
- /// </param>
|
3788
|
|
- public void BringToFront(Thumb element)//图片置于最顶层显示
|
3789
|
|
- {
|
3790
|
|
- if (element == null)
|
3791
|
|
- {
|
3792
|
|
- return;
|
3793
|
|
- }
|
3794
|
|
-
|
3795
|
|
- Canvas parent = element.Parent as Canvas;
|
3796
|
|
- if (parent == null)
|
3797
|
|
- {
|
3798
|
|
- return;
|
3799
|
|
- }
|
3800
|
|
-
|
3801
|
|
- int maxZ = parent.Children.OfType<UIElement>()//linq语句,取Zindex的最大值
|
3802
|
|
- .Where(x => x != element)
|
3803
|
|
- .Select(x => Canvas.GetZIndex(x))
|
3804
|
|
- .Max();
|
3805
|
|
- Canvas.SetZIndex(element, maxZ + 1);
|
|
3728
|
+ imageOperationUtil.imgCanvas_MouseUp();
|
3806
|
3729
|
}
|
3807
|
3730
|
|
3808
|
3731
|
private void RectRightUp_DragStarted(object sender, System.Windows.Controls.Primitives.DragStartedEventArgs e)
|
3809
|
3732
|
{
|
3810
|
|
- try
|
3811
|
|
- {
|
3812
|
|
- Thumb thu = (Thumb)sender;
|
3813
|
|
- BringToFront(thu);
|
3814
|
|
-
|
3815
|
|
- imgRightDown = new System.Drawing.PointF((float)(imgCanvas.Margin.Left + imgCanvas.ActualWidth), (float)(imgCanvas.Margin.Top + imgCanvas.ActualHeight));
|
3816
|
|
- HideAngleBorder();
|
3817
|
|
- switch (thu.Name)
|
3818
|
|
- {
|
3819
|
|
- case "RectLeftUp":
|
3820
|
|
- RectLeftUp.Visibility = Visibility.Visible;
|
3821
|
|
- break;
|
3822
|
|
-
|
3823
|
|
- case "RectRightUp":
|
3824
|
|
- RectRightUp.Visibility = Visibility.Visible;
|
3825
|
|
- break;
|
3826
|
|
-
|
3827
|
|
- case "RectLeftDown":
|
3828
|
|
- RectLeftDown.Visibility = Visibility.Visible;
|
3829
|
|
- break;
|
3830
|
|
-
|
3831
|
|
- case "RectRightDown":
|
3832
|
|
- RectRightDown.Visibility = Visibility.Visible;
|
3833
|
|
- break;
|
3834
|
|
-
|
3835
|
|
- default:
|
3836
|
|
- break;
|
3837
|
|
- }
|
3838
|
|
- }
|
3839
|
|
- catch (Exception ex)
|
3840
|
|
- {
|
3841
|
|
- MessageWindow.Show(ex.Message);
|
3842
|
|
- }
|
|
3733
|
+ imageOperationUtil.RectRightUp_DragStarted(sender, e);
|
3843
|
3734
|
}
|
3844
|
3735
|
|
3845
|
3736
|
private void RectRightUp_DragDelta(object sender, System.Windows.Controls.Primitives.DragDeltaEventArgs e)
|
3846
|
3737
|
{
|
3847
|
|
- try
|
3848
|
|
- {
|
3849
|
|
- if (mouseDown)
|
3850
|
|
- {
|
3851
|
|
- Thumb thu = (Thumb)sender;
|
3852
|
|
-
|
3853
|
|
- #region 判断是否超出 暂无
|
3854
|
|
-
|
3855
|
|
- double plul = Canvas.GetLeft(RectLeftUp);
|
3856
|
|
- double plut = Canvas.GetTop(RectLeftUp);
|
3857
|
|
- double prdl = Canvas.GetLeft(RectRightDown);
|
3858
|
|
- double prdt = Canvas.GetTop(RectRightDown);
|
3859
|
|
-
|
3860
|
|
- #endregion 判断是否超出 暂无
|
3861
|
|
-
|
3862
|
|
- //Canvas.SetLeft(thu, Canvas.GetLeft(thu) + e.HorizontalChange);
|
3863
|
|
- //Canvas.SetTop(thu, Canvas.GetTop(thu) + e.VerticalChange);
|
3864
|
|
- double imgW = 0;
|
3865
|
|
- double imgH = 0;
|
3866
|
|
- double imgX = 0;
|
3867
|
|
- double imgY = 0;
|
3868
|
|
- switch (thu.Name)
|
3869
|
|
- {
|
3870
|
|
- case "RectLeftUp":
|
3871
|
|
-
|
3872
|
|
- #region 左上
|
3873
|
|
-
|
3874
|
|
- imgW = imgRightDown.X - (Mouse.GetPosition(GridM).X);
|
3875
|
|
- imgH = imgRightDown.Y - (Mouse.GetPosition(GridM).Y);
|
3876
|
|
- imgX = 0;
|
3877
|
|
- imgY = 0;
|
3878
|
|
- if (imgW < 50)
|
3879
|
|
- {
|
3880
|
|
- imgCanvas.Width = 50;
|
3881
|
|
- imgX = imgCanvas.Margin.Left;
|
3882
|
|
- Canvas.SetLeft(thu, Canvas.GetLeft(RectRightDown) - 50);
|
3883
|
|
- }
|
3884
|
|
- else
|
3885
|
|
- {
|
3886
|
|
- imgCanvas.Width = imgW;
|
3887
|
|
- imgX = Mouse.GetPosition(GridM).X;
|
3888
|
|
- Canvas.SetLeft(thu, Canvas.GetLeft(thu) + e.HorizontalChange);
|
3889
|
|
- }
|
3890
|
|
- if (imgH < 50)
|
3891
|
|
- {
|
3892
|
|
- imgCanvas.Height = 50;
|
3893
|
|
- imgY = imgCanvas.Margin.Top;
|
3894
|
|
- Canvas.SetTop(thu, Canvas.GetTop(RectRightDown) - 50);
|
3895
|
|
- }
|
3896
|
|
- else
|
3897
|
|
- {
|
3898
|
|
- imgCanvas.Height = imgH;
|
3899
|
|
- imgY = Mouse.GetPosition(GridM).Y;
|
3900
|
|
- Canvas.SetTop(thu, Canvas.GetTop(thu) + e.VerticalChange);
|
3901
|
|
- }
|
3902
|
|
- imgCanvas.Margin = new Thickness(imgX, imgY, 0, 0);
|
3903
|
|
-
|
3904
|
|
- #endregion 左上
|
3905
|
|
-
|
3906
|
|
- break;
|
3907
|
|
-
|
3908
|
|
- case "RectRightUp":
|
3909
|
|
-
|
3910
|
|
- #region 右上
|
3911
|
|
-
|
3912
|
|
- imgW = Mouse.GetPosition(GridM).X - imgCanvas.Margin.Left;
|
3913
|
|
- imgH = imgRightDown.Y - (Mouse.GetPosition(GridM).Y);
|
3914
|
|
- imgX = 0;
|
3915
|
|
- imgY = 0;
|
3916
|
|
- if (imgW < 50)
|
3917
|
|
- {
|
3918
|
|
- imgCanvas.Width = 50;
|
3919
|
|
- imgX = imgCanvas.Margin.Left;
|
3920
|
|
- Canvas.SetLeft(thu, Canvas.GetLeft(RectLeftUp) + 50);
|
3921
|
|
- }
|
3922
|
|
- else
|
3923
|
|
- {
|
3924
|
|
- imgCanvas.Width = imgW;
|
3925
|
|
- imgX = imgCanvas.Margin.Left;
|
3926
|
|
- Canvas.SetLeft(thu, Canvas.GetLeft(thu) + e.HorizontalChange);
|
3927
|
|
- }
|
3928
|
|
- if (imgH < 50)
|
3929
|
|
- {
|
3930
|
|
- imgCanvas.Height = 50;
|
3931
|
|
- imgY = imgCanvas.Margin.Top;
|
3932
|
|
- Canvas.SetTop(thu, Canvas.GetTop(RectRightDown) - 50);
|
3933
|
|
- }
|
3934
|
|
- else
|
3935
|
|
- {
|
3936
|
|
- imgCanvas.Height = imgH;
|
3937
|
|
- imgY = Mouse.GetPosition(GridM).Y;
|
3938
|
|
- Canvas.SetTop(thu, Canvas.GetTop(thu) + e.VerticalChange);
|
3939
|
|
- }
|
3940
|
|
- imgCanvas.Margin = new Thickness(imgX, imgY, 0, 0);
|
3941
|
|
-
|
3942
|
|
- #endregion 右上
|
3943
|
|
-
|
3944
|
|
- break;
|
3945
|
|
-
|
3946
|
|
- case "RectLeftDown":
|
3947
|
|
-
|
3948
|
|
- #region 左下
|
3949
|
|
-
|
3950
|
|
- imgW = imgRightDown.X - (Mouse.GetPosition(GridM).X);
|
3951
|
|
- imgH = Mouse.GetPosition(GridM).Y - imgCanvas.Margin.Top;
|
3952
|
|
- imgX = 0;
|
3953
|
|
- imgY = 0;
|
3954
|
|
- if (imgW < 50)
|
3955
|
|
- {
|
3956
|
|
- imgCanvas.Width = 50;
|
3957
|
|
- imgX = imgCanvas.Margin.Left;
|
3958
|
|
- Canvas.SetLeft(thu, Canvas.GetLeft(RectRightDown) - 50);
|
3959
|
|
- }
|
3960
|
|
- else
|
3961
|
|
- {
|
3962
|
|
- imgCanvas.Width = imgW;
|
3963
|
|
- imgX = Mouse.GetPosition(GridM).X;
|
3964
|
|
- Canvas.SetLeft(thu, Canvas.GetLeft(thu) + e.HorizontalChange);
|
3965
|
|
- }
|
3966
|
|
- if (imgH < 50)
|
3967
|
|
- {
|
3968
|
|
- imgCanvas.Height = 50;
|
3969
|
|
- imgY = imgCanvas.Margin.Top;
|
3970
|
|
- Canvas.SetTop(thu, Canvas.GetTop(RectLeftUp) + 50);
|
3971
|
|
- }
|
3972
|
|
- else
|
3973
|
|
- {
|
3974
|
|
- imgCanvas.Height = imgH;
|
3975
|
|
- imgY = imgCanvas.Margin.Top;
|
3976
|
|
- Canvas.SetTop(thu, Canvas.GetTop(thu) + e.VerticalChange);
|
3977
|
|
- }
|
3978
|
|
- imgCanvas.Margin = new Thickness(imgX, imgY, 0, 0);
|
3979
|
|
- //imgCanvas.Width = imgRightDown.X - (Mouse.GetPosition(GridM).X);
|
3980
|
|
- //imgCanvas.Height = Mouse.GetPosition(GridM).Y - imgCanvas.Margin.Top;
|
3981
|
|
- //imgCanvas.Margin = new Thickness(Mouse.GetPosition(GridM).X, imgCanvas.Margin.Top, 0, 0);
|
3982
|
|
-
|
3983
|
|
- #endregion 左下
|
3984
|
|
-
|
3985
|
|
- break;
|
3986
|
|
-
|
3987
|
|
- case "RectRightDown":
|
3988
|
|
-
|
3989
|
|
- #region 右下
|
3990
|
|
-
|
3991
|
|
- imgW = Mouse.GetPosition(GridM).X - imgCanvas.Margin.Left;
|
3992
|
|
- imgH = Mouse.GetPosition(GridM).Y - imgCanvas.Margin.Top;
|
3993
|
|
- if (imgW < 50)
|
3994
|
|
- {
|
3995
|
|
- imgCanvas.Width = 50;
|
3996
|
|
- Canvas.SetLeft(thu, Canvas.GetLeft(RectLeftUp) + 50);
|
3997
|
|
- }
|
3998
|
|
- else
|
3999
|
|
- {
|
4000
|
|
- imgCanvas.Width = imgW;
|
4001
|
|
- Canvas.SetLeft(thu, Canvas.GetLeft(thu) + e.HorizontalChange);
|
4002
|
|
- }
|
4003
|
|
- if (imgH < 50)
|
4004
|
|
- {
|
4005
|
|
- imgCanvas.Height = 50;
|
4006
|
|
- Canvas.SetTop(thu, Canvas.GetTop(RectLeftUp) + 50);
|
4007
|
|
- }
|
4008
|
|
- else
|
4009
|
|
- {
|
4010
|
|
- imgCanvas.Height = imgH;
|
4011
|
|
- Canvas.SetTop(thu, Canvas.GetTop(thu) + e.VerticalChange);
|
4012
|
|
- }
|
4013
|
|
- //imgCanvas.Margin = new Thickness(imgX, imgY, 0, 0);
|
4014
|
|
- //imgCanvas.Width += e.HorizontalChange;
|
4015
|
|
- //imgCanvas.Height += e.VerticalChange;
|
4016
|
|
-
|
4017
|
|
- #endregion 右下
|
4018
|
|
-
|
4019
|
|
- break;
|
4020
|
|
-
|
4021
|
|
- default:
|
4022
|
|
- break;
|
4023
|
|
- }
|
4024
|
|
- APP.PageDrawList[APP.PageContextData.currpage - 1].ImageLocation = new TranslateTransform
|
4025
|
|
- {
|
4026
|
|
- X = imgCanvas.Margin.Left,
|
4027
|
|
- Y = imgCanvas.Margin.Top
|
4028
|
|
- };
|
4029
|
|
- APP.PageDrawList[APP.PageContextData.currpage - 1].ImageSizes = new ScaleTransform
|
4030
|
|
- {
|
4031
|
|
- CenterX = imgCanvas.ActualWidth,
|
4032
|
|
- CenterY = imgCanvas.ActualHeight
|
4033
|
|
- };
|
4034
|
|
- APP.PageDrawList[APP.PageContextData.currpage - 1].IsImageLocation = false;
|
4035
|
|
- }
|
4036
|
|
- //lbl1.Content = imgCanvas.Margin.Left + "," + imgCanvas.Margin.Top;
|
4037
|
|
- //lbl2.Content = (imgCanvas.Margin.Left+ imgCanvas.Width) +"," + imgCanvas.Margin.Top;
|
4038
|
|
- //lbl3.Content = imgCanvas.Margin.Left + "," + (imgCanvas.Margin.Top+ imgCanvas.Height);
|
4039
|
|
- //lbl4.Content= (imgCanvas.Margin.Left + imgCanvas.Width )+ "," + (imgCanvas.Margin.Top + imgCanvas.Height);
|
4040
|
|
- }
|
4041
|
|
- catch (Exception)
|
4042
|
|
- {
|
4043
|
|
- MessageWindow.Show("图片过小!");
|
4044
|
|
- }
|
|
3738
|
+ imageOperationUtil.RectRightUp_DragDelta(sender, e);
|
4045
|
3739
|
}
|
4046
|
3740
|
|
4047
|
3741
|
private void RectRightUp_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e)
|
4048
|
3742
|
{
|
4049
|
|
- ShowAngleBorder();
|
|
3743
|
+ imageOperationUtil.RectRightUp_DragCompleted();
|
4050
|
3744
|
}
|
4051
|
3745
|
|
4052
|
3746
|
/// <summary>
|
|
@@ -4058,7 +3752,7 @@ namespace XHWK.WKTool
|
4058
|
3752
|
/// </param>
|
4059
|
3753
|
private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
|
4060
|
3754
|
{
|
4061
|
|
- HideAngleBorder();
|
|
3755
|
+ imageOperationUtil.Grid_MouseDown();
|
4062
|
3756
|
}
|
4063
|
3757
|
|
4064
|
3758
|
/// <summary>
|
|
@@ -4070,10 +3764,7 @@ namespace XHWK.WKTool
|
4070
|
3764
|
/// </param>
|
4071
|
3765
|
private void Window_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)
|
4072
|
3766
|
{
|
4073
|
|
- if (RectImgBorder.Visibility != Visibility.Hidden)
|
4074
|
|
- {
|
4075
|
|
- HideAngleBorder();
|
4076
|
|
- }
|
|
3767
|
+ imageOperationUtil.Window_MouseLeftButtonDown_1();
|
4077
|
3768
|
}
|
4078
|
3769
|
|
4079
|
3770
|
#endregion 图片拉伸移动
|