Sfoglia il codice sorgente

zhao:1增加鼠标操作类。2修改录制区域大小,解决小屏幕笔迹拉伸及错位问题,3录屏批注时右键取消录屏时激活鼠标下的页面。

tags/录制修改前
耀 4 anni fa
parent
commit
eec3575586

+ 1
- 0
Common/Common.csproj Vedi File

@@ -121,6 +121,7 @@
121 121
     <Compile Include="system\DataProvider.cs" />
122 122
     <Compile Include="system\KeyboardHookCommon.cs" />
123 123
     <Compile Include="system\LatticeFileHelper.cs" />
124
+    <Compile Include="system\MouseEventCommon.cs" />
124 125
     <Compile Include="system\PdfTrunImage.cs" />
125 126
     <Compile Include="system\BlackboardNew.cs" />
126 127
     <Compile Include="system\CameraHelper.cs" />

+ 100
- 0
Common/system/MouseEventCommon.cs Vedi File

@@ -0,0 +1,100 @@
1
+using System;
2
+using System.Collections.Generic;
3
+using System.Linq;
4
+using System.Runtime.InteropServices;
5
+using System.Text;
6
+using System.Threading.Tasks;
7
+
8
+namespace Common.system
9
+{
10
+    public class MouseEventCommon
11
+    {
12
+        //[DllImport("user32.dll")]
13
+        //static extern void mouse_event(MouseEventFlag flags, int dx, int dy, uint data, UIntPtr extraInfo);
14
+
15
+        [DllImport("user32")]
16
+        private static extern int mouse_event(int dwFlags, int dx, int dy, int cButtons, int dwExtraInfo);
17
+        /// <summary>
18
+        /// 设置鼠标的坐标 
19
+        /// </summary>
20
+        /// <param name="x">横坐标</param>
21
+        /// <param name="y">纵坐标</param>
22
+        /// <returns></returns>
23
+        [DllImport("user32.dll")]
24
+        public static extern int SetCursorPos(int x, int y);
25
+        
26
+        /// <summary>   
27
+        /// 获取鼠标的坐标   
28
+        /// </summary>   
29
+        /// <param name="lpPoint">传址参数,坐标point类型</param>   
30
+        /// <returns>获取成功返回真</returns>   
31
+
32
+
33
+        [DllImport("user32.dll", CharSet = CharSet.Auto)]
34
+        public static extern bool GetCursorPos(out POINT pt);
35
+
36
+        /// <summary>
37
+        /// 鼠标点击左键
38
+        /// </summary>
39
+        /// <param name="dx">坐标x</param>
40
+        /// <param name="dy">坐标Y</param>
41
+        /// <param name="data"></param>
42
+        public static void MouseLefClickEvent(int dx, int dy, int data)
43
+        {
44
+            GetCursorPos(out POINT pointRecord);
45
+            mouse_event((int)MouseEventFlag.MiddleDown, pointRecord.X, pointRecord.Y, data, 0);
46
+            mouse_event((int)MouseEventFlag.MiddleUp, pointRecord.X, pointRecord.Y, data, 0);
47
+        }
48
+        public static void MouseText(int dx, int dy)
49
+        {
50
+            mouse_event((int)MouseEventFlag.LeftDown, dx, dy, 0, 0);
51
+            mouse_event((int)MouseEventFlag.LeftUp, dx, dy, 0, 0);
52
+        }
53
+        /// <summary>
54
+        /// 鼠标点击中中键
55
+        /// </summary>
56
+        /// <param name="data"></param>
57
+        public static void MouseMiddleClickEvent(int data)
58
+        {
59
+            GetCursorPos(out POINT pointRecord);
60
+            mouse_event((int)MouseEventFlag.MiddleDown, pointRecord.X, pointRecord.Y, data, 0);
61
+            mouse_event((int)MouseEventFlag.MiddleUp, pointRecord.X, pointRecord.Y, data, 0);
62
+        }
63
+
64
+        public struct POINT
65
+        {
66
+            public int X;
67
+            public int Y;
68
+            public POINT(int x, int y)
69
+            {
70
+                this.X = x;
71
+                this.Y = y;
72
+            }
73
+
74
+        }
75
+
76
+        enum MouseEventFlag : uint
77
+        {
78
+            //移动鼠标 
79
+            Move = 0x0001,
80
+            //模拟鼠标左键按下 
81
+            LeftDown = 0x0002,
82
+            //模拟鼠标左键抬起 
83
+            LeftUp = 0x0004,
84
+            //模拟鼠标右键按下 
85
+            RightDown = 0x0008,
86
+            //模拟鼠标右键抬起 
87
+            RightUp = 0x0010,
88
+            //模拟鼠标中键按下 
89
+            MiddleDown = 0x0020,
90
+            //模拟鼠标中键抬起 
91
+            MiddleUp = 0x0040,
92
+            XDown = 0x0080,
93
+            XUp = 0x0100,
94
+            Wheel = 0x0800,
95
+            VirtualDesk = 0x4000,
96
+            //标示是否采用绝对坐标 
97
+            Absolute = 0x8000
98
+        }
99
+    }
100
+}

+ 23
- 1
XHWK.WKTool/PracticeWindow.xaml.cs Vedi File

@@ -1,4 +1,5 @@
1
-using System;
1
+using Common.system;
2
+using System;
2 3
 using System.Collections.Generic;
3 4
 using System.Threading;
4 5
 using System.Windows;
@@ -363,6 +364,25 @@ namespace XHWK.WKTool
363 364
             }
364 365
             Hide();
365 366
         }
367
+        /// <summary>
368
+        /// 鼠标中建点击
369
+        /// </summary>
370
+        void SwitchPages()
371
+        {
372
+            try
373
+            {
374
+                new Thread(() =>
375
+                {
376
+                    Thread.Sleep(500);
377
+                    MouseEventCommon.MouseMiddleClickEvent(0);
378
+                }).Start();
379
+            }
380
+            catch (Exception ex)
381
+            {
382
+                MessageBox.Show(ex.Message);
383
+            }
384
+        }
385
+
366 386
 
367 387
         private void blackboard_canvas_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
368 388
         {
@@ -388,6 +408,8 @@ namespace XHWK.WKTool
388 408
                 APP.W_ScreenRecordingToolbarWindow.flg = 1;
389 409
             }
390 410
             ReturnPractice();
411
+            //模拟切到ppt
412
+            SwitchPages();
391 413
             //Hide();
392 414
         }
393 415
         /// <summary>

+ 11
- 0
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs Vedi File

@@ -2,6 +2,7 @@
2 2
 
3 3
 using System;
4 4
 using System.IO;
5
+using System.Runtime.InteropServices;
5 6
 using System.Threading;
6 7
 using System.Windows;
7 8
 using System.Windows.Forms;
@@ -1194,5 +1195,15 @@ namespace XHWK.WKTool
1194 1195
             borOne.Background = new SolidColorBrush(Colors.DodgerBlue);
1195 1196
             borTwo.Background = new SolidColorBrush(Colors.DodgerBlue);
1196 1197
         }
1198
+
1199
+        /// <summary>
1200
+        /// 切换页面
1201
+        /// </summary>
1202
+        void SwitchPages()
1203
+        {
1204
+            //SendKeys.SendWait("%{TAB}");
1205
+            MouseEventCommon.MouseMiddleClickEvent(0);
1206
+        }
1207
+
1197 1208
     }
1198 1209
 }

+ 10
- 5
XHWK.WKTool/XHMicroLessonSystemWindow.xaml Vedi File

@@ -9,7 +9,7 @@
9 9
         xmlns:local="clr-namespace:XHWK.WKTool"
10 10
         mc:Ignorable="d"
11 11
         Title="星火微课系统" Height="1036" Width="1290" 
12
-    WindowStyle="None"  WindowStartupLocation="CenterScreen"  AllowsTransparency="True"  Background="Transparent"    ShowInTaskbar="True" ResizeMode="CanMinimize" BorderThickness="7" MouseLeftButtonDown="Window_MouseLeftButtonDown_1">
12
+    WindowStyle="None"  WindowStartupLocation="CenterScreen"  AllowsTransparency="True"  Background="Transparent"    ShowInTaskbar="True" ResizeMode="CanMinimize" BorderThickness="7" MouseLeftButtonDown="Window_MouseLeftButtonDown_1" Loaded="Window_Loaded">
13 13
     <Window.Effect>
14 14
         <DropShadowEffect BlurRadius="10" Color="#bababa" Direction="80" ShadowDepth="0"/>
15 15
     </Window.Effect>
@@ -299,7 +299,7 @@
299 299
             <Border  Grid.Row="1">
300 300
                 <Grid Grid.Row="1" x:Name="GridMain" Visibility="Visible" MouseLeftButtonDown="Window_MouseLeftButtonDown_1">
301 301
                     <ScrollViewer x:Name="scroMain" VerticalScrollBarVisibility="Visible" MouseLeftButtonDown="Window_MouseLeftButtonDown_1">
302
-                        <Grid x:Name="gridM"  Margin="0,0,0,0" Background="#FFFFFF" Visibility="Visible" Height="1780" MouseLeftButtonDown="Window_MouseLeftButtonDown_1">
302
+                        <Grid x:Name="gridM"  Margin="0,0,0,0" Background="#FFFFFF" Visibility="Visible" Width="auto" Height="1780" MouseLeftButtonDown="Window_MouseLeftButtonDown_1">
303 303
                             <Grid>
304 304
                                 <Border Grid.Row="1"  CornerRadius="5">
305 305
                                     <Grid x:Name="IMG" Margin="0,0,0,0">
@@ -330,9 +330,14 @@
330 330
                                     </Canvas>
331 331
                                 </Grid>
332 332
                             </Border>
333
-                        </Grid>
334
-                        <Image x:Name="imgDocumentation" Visibility="Visible" VerticalAlignment="Top" Stretch="Fill"/>
335
-                        <Image x:Name="imgPPT" Visibility="Visible" VerticalAlignment="Top"/>
333
+                            </Grid>
334
+                            <Image x:Name="imgDocumentation" Visibility="Visible" Stretch="Fill"/>
335
+                            <!--<Grid Width="auto" Height="auto" HorizontalAlignment="Center" VerticalAlignment="Center">
336
+                                <Border BorderBrush="#FF171515" BorderThickness="2">
337
+                                    <Image x:Name="imgDocumentation" Visibility="Visible" Stretch="Fill"/>
338
+                                </Border>
339
+                            </Grid>-->
340
+                            <Image x:Name="imgPPT" Visibility="Visible" VerticalAlignment="Top"/>
336 341
                         <!--导入图片-->
337 342
                         <!--<Button Cursor="Hand" x:Name="btnOk" Height="50" Width="50" Content="√" FontSize="26" Background="#2E8CF0" Foreground="#FFFFFF" Click="btnOk_Click" Visibility="Collapsed"/>-->
338 343
                         <InkCanvas Grid.Row="0" x:Name="blackboard_canvas"  Background="Transparent" Visibility="Collapsed" Grid.ColumnSpan="2"/>

+ 9
- 0
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs Vedi File

@@ -211,6 +211,8 @@ namespace XHWK.WKTool
211 211
             //wfhCamera.Visibility = Visibility.Hidden;
212 212
             ImgPDFPath = null;
213 213
             ImgPDFPath = new string[300];
214
+            //gridM.Height = gridM.ActualWidth / proportion;
215
+            //gridM.Height = gridM.Width / proportion;
214 216
         }
215 217
         /// <summary>
216 218
         /// 初始化快捷键
@@ -5059,5 +5061,12 @@ namespace XHWK.WKTool
5059 5061
                 HideAngleBorder();
5060 5062
             }
5061 5063
         }
5064
+
5065
+        private void Window_Loaded(object sender, RoutedEventArgs e)
5066
+        {
5067
+            //调整录制区域宽高
5068
+            double proportion = 210.0 / 297.0;
5069
+            gridM.Height = gridM.ActualWidth / proportion;
5070
+        }
5062 5071
     }
5063 5072
 }

Loading…
Annulla
Salva