@@ -591,7 +591,7 @@ private void inkCanvas_PreviewTouchDown(object sender, TouchEventArgs e)
591591 //设备两个及两个以上,将画笔功能关闭
592592 if ( dec . Count > 1 )
593593 {
594- if ( inkCanvas . EditingMode != InkCanvasEditingMode . None )
594+ if ( inkCanvas . EditingMode != InkCanvasEditingMode . None && inkCanvas . EditingMode != InkCanvasEditingMode . Select )
595595 {
596596 lastInkCanvasEditingMode = inkCanvas . EditingMode ;
597597 inkCanvas . EditingMode = InkCanvasEditingMode . None ;
@@ -617,6 +617,11 @@ private void inkCanvas_ManipulationStarting(object sender, ManipulationStartingE
617617 e . Mode = ManipulationModes . All ;
618618 }
619619
620+ private void inkCanvas_ManipulationInertiaStarting ( object sender , ManipulationInertiaStartingEventArgs e )
621+ {
622+
623+ }
624+
620625 private void Main_Grid_ManipulationCompleted ( object sender , ManipulationCompletedEventArgs e )
621626 {
622627 if ( e . Manipulators . Count ( ) == 0 )
@@ -650,12 +655,26 @@ private void Main_Grid_ManipulationDelta(object sender, ManipulationDeltaEventAr
650655 }
651656 m . ScaleAt ( scale . X , scale . Y , center . X , center . Y ) ; // 缩放
652657
653- foreach ( Stroke stroke in inkCanvas . Strokes )
658+ StrokeCollection strokes = inkCanvas . GetSelectedStrokes ( ) ;
659+ if ( strokes . Count != 0 )
654660 {
655- stroke . Transform ( m , false ) ;
661+ foreach ( Stroke stroke in strokes )
662+ {
663+ stroke . Transform ( m , false ) ;
656664
657- stroke . DrawingAttributes . Width *= md . Scale . X ;
658- stroke . DrawingAttributes . Height *= md . Scale . Y ;
665+ stroke . DrawingAttributes . Width *= md . Scale . X ;
666+ stroke . DrawingAttributes . Height *= md . Scale . Y ;
667+ }
668+ }
669+ else
670+ {
671+ foreach ( Stroke stroke in inkCanvas . Strokes )
672+ {
673+ stroke . Transform ( m , false ) ;
674+
675+ stroke . DrawingAttributes . Width *= md . Scale . X ;
676+ stroke . DrawingAttributes . Height *= md . Scale . Y ;
677+ }
659678 }
660679 }
661680 }
@@ -883,6 +902,7 @@ private void TimerCheckPPT_Elapsed(object sender, ElapsedEventArgs e)
883902
884903 private void PptApplication_PresentationClose ( Presentation Pres )
885904 {
905+ pptApplication = null ;
886906 timerCheckPPT . Start ( ) ;
887907 BtnPPTSlideShow . Visibility = Visibility . Collapsed ;
888908 BtnPPTSlideShowEnd . Visibility = Visibility . Collapsed ;
@@ -892,6 +912,9 @@ private void PptApplication_SlideShowBegin(SlideShowWindow Wn)
892912 {
893913 Application . Current . Dispatcher . Invoke ( ( ) =>
894914 {
915+ slidescount = Wn . Presentation . Slides . Count ;
916+ memoryStreams = new MemoryStream [ slidescount + 2 ] ;
917+
895918 StackPanelPPTControls . Visibility = Visibility . Visible ;
896919 BtnPPTSlideShow . Visibility = Visibility . Collapsed ;
897920 BtnPPTSlideShowEnd . Visibility = Visibility . Visible ;
@@ -900,6 +923,11 @@ private void PptApplication_SlideShowBegin(SlideShowWindow Wn)
900923 {
901924 BtnHideInkCanvas_Click ( BtnHideInkCanvas , null ) ;
902925 }
926+ if ( GridBackgroundCover . Visibility == Visibility . Visible )
927+ {
928+ currentMode = 0 ;
929+ GridBackgroundCover . Visibility = Visibility . Hidden ;
930+ }
903931 inkCanvas . Strokes . Clear ( ) ;
904932 } ) ;
905933 previousSlideID = Wn . View . CurrentShowPosition ;
@@ -1021,11 +1049,6 @@ private void BtnPPTSlideShow_Click(object sender, RoutedEventArgs e)
10211049 }
10221050 catch { }
10231051 } ) ) . Start ( ) ;
1024-
1025- if ( currentMode == 1 )
1026- {
1027- BtnSwitch_Click ( BtnSwitch , e ) ;
1028- }
10291052 }
10301053
10311054 private void BtnPPTSlideShowEnd_Click ( object sender , RoutedEventArgs e )
@@ -1384,14 +1407,6 @@ private void ToggleSwitchShowCursor_Toggled(object sender, RoutedEventArgs e)
13841407 SaveSettingsToFile ( ) ;
13851408 }
13861409
1387- private void BtnSelect_Click ( object sender , RoutedEventArgs e )
1388- {
1389- forceEraser = true ;
1390- drawingShapeMode = 0 ;
1391- inkCanvas . EditingMode = InkCanvasEditingMode . Select ;
1392- inkCanvas . IsManipulationEnabled = false ;
1393- }
1394-
13951410 int drawingShapeMode = 0 ;
13961411
13971412 private void BtnPen_Click ( object sender , RoutedEventArgs e )
@@ -1440,7 +1455,10 @@ private void inkCanvas_TouchMove(object sender, TouchEventArgs e)
14401455 {
14411456 if ( isLastTouchEraser )
14421457 {
1443- inkCanvas . EditingMode = InkCanvasEditingMode . EraseByStroke ;
1458+ if ( inkCanvas . EditingMode != InkCanvasEditingMode . EraseByStroke )
1459+ {
1460+ inkCanvas . EditingMode = InkCanvasEditingMode . EraseByStroke ;
1461+ }
14441462 return ;
14451463 }
14461464 if ( isWaitUntilNextTouchDown ) return ;
@@ -1663,6 +1681,128 @@ private void BtnResetToDefault_Click(object sender, RoutedEventArgs e)
16631681 } ) ;
16641682 } ) ) . Start ( ) ;
16651683 }
1684+
1685+ private void BtnSelect_Click ( object sender , RoutedEventArgs e )
1686+ {
1687+ forceEraser = true ;
1688+ drawingShapeMode = 0 ;
1689+ inkCanvas . EditingMode = InkCanvasEditingMode . Select ;
1690+ inkCanvas . IsManipulationEnabled = false ;
1691+ }
1692+
1693+ private void inkCanvas_SelectionChanged ( object sender , EventArgs e )
1694+ {
1695+ if ( inkCanvas . GetSelectedStrokes ( ) . Count == 0 )
1696+ {
1697+ GridInkCanvasSelectionCover . Visibility = Visibility . Collapsed ;
1698+
1699+ }
1700+ else
1701+ {
1702+ GridInkCanvasSelectionCover . Visibility = Visibility . Visible ;
1703+ //GridInkCanvasSelectionCover.Height = inkCanvas.GetSelectionBounds().Height;
1704+ //GridInkCanvasSelectionCover.Width = inkCanvas.GetSelectionBounds().Width;
1705+ //GridInkCanvasSelectionCover.Margin = new Thickness(inkCanvas.GetSelectionBounds().Left, inkCanvas.GetSelectionBounds().Top, 0, 0);
1706+ }
1707+ }
1708+
1709+ private void GridInkCanvasSelectionCover_ManipulationStarting ( object sender , ManipulationStartingEventArgs e )
1710+ {
1711+ e . Mode = ManipulationModes . All ;
1712+ }
1713+
1714+ private void GridInkCanvasSelectionCover_ManipulationCompleted ( object sender , ManipulationCompletedEventArgs e )
1715+ {
1716+
1717+ }
1718+
1719+ private void GridInkCanvasSelectionCover_ManipulationDelta ( object sender , ManipulationDeltaEventArgs e )
1720+ {
1721+ if ( dec . Count >= 1 )
1722+ {
1723+ ManipulationDelta md = e . DeltaManipulation ;
1724+ Vector trans = md . Translation ; // 获得位移矢量
1725+ double rotate = md . Rotation ; // 获得旋转角度
1726+ Vector scale = md . Scale ; // 获得缩放倍数
1727+
1728+ Matrix m = new Matrix ( ) ;
1729+
1730+ // Find center of element and then transform to get current location of center
1731+ FrameworkElement fe = e . Source as FrameworkElement ;
1732+ Point center = new Point ( fe . ActualWidth / 2 , fe . ActualHeight / 2 ) ;
1733+ center = m . Transform ( center ) ; // 转换为矩阵缩放和旋转的中心点
1734+
1735+ // Update matrix to reflect translation/rotation
1736+ m . Translate ( trans . X , trans . Y ) ; // 移动
1737+ if ( Settings . Gesture . IsEnableTwoFingerRotation )
1738+ {
1739+ m . RotateAt ( rotate , center . X , center . Y ) ; // 旋转
1740+ }
1741+ m . ScaleAt ( scale . X , scale . Y , center . X , center . Y ) ; // 缩放
1742+
1743+ StrokeCollection strokes = inkCanvas . GetSelectedStrokes ( ) ;
1744+ foreach ( Stroke stroke in strokes )
1745+ {
1746+ stroke . Transform ( m , false ) ;
1747+
1748+ stroke . DrawingAttributes . Width *= md . Scale . X ;
1749+ stroke . DrawingAttributes . Height *= md . Scale . Y ;
1750+ }
1751+ }
1752+ }
1753+
1754+ private void GridInkCanvasSelectionCover_TouchDown ( object sender , TouchEventArgs e )
1755+ {
1756+ }
1757+
1758+ private void GridInkCanvasSelectionCover_TouchUp ( object sender , TouchEventArgs e )
1759+ {
1760+ }
1761+
1762+ Point lastTouchPointOnGridInkCanvasCover = new Point ( 0 , 0 ) ;
1763+ private void GridInkCanvasSelectionCover_PreviewTouchDown ( object sender , TouchEventArgs e )
1764+ {
1765+ dec . Add ( e . TouchDevice . Id ) ;
1766+ //设备1个的时候,记录中心点
1767+ if ( dec . Count == 1 )
1768+ {
1769+ TouchPoint touchPoint = e . GetTouchPoint ( null ) ;
1770+ centerPoint = touchPoint . Position ;
1771+ lastTouchPointOnGridInkCanvasCover = touchPoint . Position ;
1772+ }
1773+ ////设备两个及两个以上,将画笔功能关闭
1774+ //if (dec.Count > 1)
1775+ //{
1776+ // if (inkCanvas.EditingMode != InkCanvasEditingMode.None && inkCanvas.EditingMode != InkCanvasEditingMode.Select)
1777+ // {
1778+ // lastInkCanvasEditingMode = inkCanvas.EditingMode;
1779+ // inkCanvas.EditingMode = InkCanvasEditingMode.None;
1780+ // }
1781+ //}
1782+ }
1783+
1784+ private void GridInkCanvasSelectionCover_PreviewTouchUp ( object sender , TouchEventArgs e )
1785+ {
1786+ if ( lastTouchPointOnGridInkCanvasCover == e . GetTouchPoint ( null ) . Position )
1787+ {
1788+ if ( lastTouchPointOnGridInkCanvasCover . X < inkCanvas . GetSelectionBounds ( ) . Left ||
1789+ lastTouchPointOnGridInkCanvasCover . Y < inkCanvas . GetSelectionBounds ( ) . Top ||
1790+ lastTouchPointOnGridInkCanvasCover . X > inkCanvas . GetSelectionBounds ( ) . Right ||
1791+ lastTouchPointOnGridInkCanvasCover . Y > inkCanvas . GetSelectionBounds ( ) . Bottom )
1792+ {
1793+ inkCanvas . Select ( new StrokeCollection ( ) ) ;
1794+ }
1795+ }
1796+ ////手势完成后切回之前的状态
1797+ //if (dec.Count > 1)
1798+ //{
1799+ // if (inkCanvas.EditingMode == InkCanvasEditingMode.None)
1800+ // {
1801+ // inkCanvas.EditingMode = lastInkCanvasEditingMode;
1802+ // }
1803+ //}
1804+ dec . Remove ( e . TouchDevice . Id ) ;
1805+ }
16661806 }
16671807
16681808 enum HotkeyModifiers
0 commit comments