Procházet zdrojové kódy

工具栏 缩放功能

tags/录制修改前
zhangxueyang před 3 roky
rodič
revize
fcc346c181

+ 2
- 2
XHWK.WKTool/App.config Zobrazit soubor

@@ -32,8 +32,8 @@
32 32
     <!--上传每片大小 Mb-->
33 33
     <add key="UploadSliceLen" value="1" />
34 34
     <!--版本号-->
35
-    <add key="VersionCode" value="50" />
36
-    <add key="VersionName" value="2.5.0" />
35
+    <add key="VersionCode" value="51" />
36
+    <add key="VersionName" value="2.5.1" />
37 37
     <add key="ClientSettingsProvider.ServiceUri" value="" />
38 38
   </appSettings>
39 39
   <system.web>

+ 4
- 0
XHWK.WKTool/App.cs Zobrazit soubor

@@ -189,6 +189,10 @@ namespace XHWK.WKTool
189 189
         /// 上传页面
190 190
         /// </summary>
191 191
         public static UploadWindow W_UploadWindow = null;
192
+        /// <summary>
193
+        /// 最小化工具栏
194
+        /// </summary>
195
+        public static MinToolbar W_MinToolbar = null;
192 196
         #endregion
193 197
         #endregion
194 198
 

+ 40
- 0
XHWK.WKTool/MinToolbar.xaml Zobrazit soubor

@@ -0,0 +1,40 @@
1
+<Window x:Class="XHWK.WKTool.MinToolbar"
2
+        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
5
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
6
+        xmlns:local="clr-namespace:XHWK.WKTool"
7
+        mc:Ignorable="d"
8
+        Title="MinToolbar" Height="50" Width="20" AllowsTransparency="True" 
9
+        Topmost="True"
10
+    ShowInTaskbar="False"
11
+    WindowStyle="None" Margin="0" Left="0" Top="0">
12
+    <Window.Background>
13
+        <SolidColorBrush Opacity="0" Color="#00000000" />
14
+    </Window.Background>
15
+    <Viewbox>
16
+        <Grid>
17
+            <Border Background="White" CornerRadius="3">
18
+                <Button x:Name="buttonMin" Height="25" Width="3"
19
+                        Margin="0.5"  Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}"
20
+                        MouseEnter="buttonMin_MouseEnter">
21
+                    <Button.Template>
22
+                        <ControlTemplate TargetType="{x:Type Button}">
23
+                            <Border
24
+                                BorderBrush="{TemplateBinding Control.BorderBrush}"
25
+                                BorderThickness="0"
26
+                                CornerRadius="3">
27
+                                <Border.Background>#2d8cf0</Border.Background>
28
+                                <ContentPresenter
29
+                                    HorizontalAlignment="Center"
30
+                                    VerticalAlignment="Center"
31
+                                    Content="{TemplateBinding ContentControl.Content}" />
32
+                            </Border>
33
+                        </ControlTemplate>
34
+                    </Button.Template>
35
+                </Button>
36
+            </Border>
37
+            
38
+        </Grid>
39
+    </Viewbox>
40
+</Window>

+ 49
- 0
XHWK.WKTool/MinToolbar.xaml.cs Zobrazit soubor

@@ -0,0 +1,49 @@
1
+
2
+using System;
3
+using System.Windows;
4
+
5
+
6
+namespace XHWK.WKTool
7
+{
8
+    /// <summary>
9
+    /// 最小化工具栏
10
+    /// </summary>
11
+    public partial class MinToolbar : Window
12
+    {
13
+        /// <summary>
14
+        /// 屏幕宽
15
+        /// </summary>
16
+        internal double pwidth = SystemParameters.PrimaryScreenWidth;
17
+
18
+        /// <summary>
19
+        /// 屏幕高
20
+        /// </summary>
21
+        internal double pHeight = SystemParameters.PrimaryScreenHeight;
22
+        public MinToolbar()
23
+        {
24
+            InitializeComponent();
25
+            ResizeMode = ResizeMode.NoResize;
26
+            Topmost = true;
27
+         
28
+        }
29
+        public void Initialize(double top)
30
+        {
31
+            var desktopWorkingArea = System.Windows.SystemParameters.WorkArea;
32
+            this.Left = desktopWorkingArea.Right - this.Width+7;
33
+            this.Top = top+330;
34
+
35
+            //Console.WriteLine(this.Top + "min");
36
+        }
37
+
38
+        private void buttonMin_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
39
+        {
40
+            this.Hide();
41
+            APP.W_ScreenRecordingToolbarWindow.MaxToobar();
42
+        }
43
+
44
+        private void buttonMin_MouseEnter_1(object sender, System.Windows.Input.MouseEventArgs e)
45
+        {
46
+
47
+        }
48
+    }
49
+}

+ 2
- 2
XHWK.WKTool/Properties/AssemblyInfo.cs Zobrazit soubor

@@ -49,5 +49,5 @@ using System.Windows;
49 49
 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
50 50
 //通过使用 "*",如下所示:
51 51
 // [assembly: AssemblyVersion("1.0.*")]
52
-[assembly: AssemblyVersion("2.5.0.0")]
53
-[assembly: AssemblyFileVersion("2.5.0.0")]
52
+[assembly: AssemblyVersion("2.5.1.0")]
53
+[assembly: AssemblyFileVersion("2.5.1.0")]

+ 5
- 2
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml Zobrazit soubor

@@ -14,7 +14,7 @@
14 14
         <SolidColorBrush Opacity="0" Color="#292C2E" />
15 15
     </Window.Background>
16 16
     <Viewbox>
17
-        <Grid MouseLeftButtonDown="Grid_MouseLeftButtonDown">
17
+        <Grid x:Name="gridToobar" MouseLeftButtonDown="Grid_MouseLeftButtonDown">
18 18
             <Grid.RowDefinitions>
19 19
                 <RowDefinition Height="auto"/>
20 20
                 <RowDefinition Height="auto"/>
@@ -72,7 +72,9 @@
72 72
                     <Button  Cursor="Hand" x:Name="btnCrude" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Background="#FFFFFF" Height="10" Width="20" Margin="0,10,0,0" Click="BtnCrude_Click"/>
73 73
                 </StackPanel>
74 74
             </Grid>
75
-
75
+            <Grid Grid.Row="1" x:Name="gridToobarTwo" MouseLeave="gridToobarTwo_MouseLeave">
76
+                
77
+           
76 78
             <Image Grid.Row="1"  Source="./Images/Toobar0.png"/>
77 79
             <Button Grid.Row="1" x:Name="BtnRecordingScreen" HorizontalAlignment="Left"  Cursor="Hand" Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" Margin="46,0,15,0" ToolTip="开始" Click="BtnRecordingScreen_Click">
78 80
                 <Image x:Name="ImgRecordingScreen" Source="./Images/Toobar26.png"/>
@@ -103,6 +105,7 @@
103 105
                     </Border>
104 106
                 </Button>
105 107
             </StackPanel>
108
+            </Grid>
106 109
         </Grid>
107 110
     </Viewbox>
108 111
 </Window>

+ 52
- 0
XHWK.WKTool/ScreenRecordingToolbarWindow.xaml.cs Zobrazit soubor

@@ -1,6 +1,7 @@
1 1
 using Common.system;
2 2
 
3 3
 using System;
4
+using System.Drawing;
4 5
 using System.IO;
5 6
 using System.Threading;
6 7
 using System.Windows;
@@ -79,6 +80,7 @@ namespace XHWK.WKTool
79 80
         /// </summary>
80 81
         public void Initialize()
81 82
         {
83
+            gridToobar.Visibility = Visibility.Visible;
82 84
             if (APP.W_PracticeWindow == null)
83 85
             {
84 86
                 APP.W_PracticeWindow = new PracticeWindow
@@ -420,6 +422,15 @@ namespace XHWK.WKTool
420 422
                                                         //imgReturn.Source = new BitmapImage(new Uri("pack://application:,,,/Images/Toobar30.png"));
421 423
                                                         //borOne.Background = new SolidColorBrush(Colors.LightBlue);
422 424
                 BtnRecordingScreen.ToolTip = "暂停";
425
+
426
+                if (APP.W_MinToolbar == null)
427
+                {
428
+                    APP.W_MinToolbar = new MinToolbar();
429
+
430
+                }
431
+                APP.W_MinToolbar.Initialize(this.Top);
432
+                gridToobar.Visibility = Visibility.Hidden;
433
+                APP.W_MinToolbar.Show();
423 434
                 try
424 435
                 {
425 436
                     #region 4秒内不可点击
@@ -552,6 +563,8 @@ namespace XHWK.WKTool
552 563
                 }))).Start();
553 564
             }
554 565
             #endregion
566
+            APP.W_MinToolbar.Hide();
567
+            BtnRecordingScreen.ToolTip = "开始";
555 568
             k_hook.Stop();
556 569
             IsSuspend = true;
557 570
             txbTime.Text = "00:00";
@@ -634,6 +647,14 @@ namespace XHWK.WKTool
634 647
             }
635 648
             Hide();
636 649
         }
650
+        public void MaxToobar()
651
+        {
652
+            Graphics graphics = Graphics.FromHwnd(IntPtr.Zero);
653
+            float DIP = graphics.DpiX;
654
+            float DIPY = graphics.DpiY;
655
+            APP.W_ScreenRecordingToolbarWindow.Left = PrimaryScreen.WorkingArea.Width / (DIP / 96) - APP.W_ScreenRecordingToolbarWindow.Width + 10;
656
+            gridToobar.Visibility = Visibility.Visible;
657
+        }
637 658
         #endregion
638 659
 
639 660
         #region 画笔相关
@@ -1131,6 +1152,8 @@ namespace XHWK.WKTool
1131 1152
                     return;
1132 1153
                 }
1133 1154
                 k_hook.Stop();
1155
+                BtnRecordingScreen.ToolTip = "开始";
1156
+                APP.W_MinToolbar.Hide();
1134 1157
                 IsSuspend = true;
1135 1158
                 txbTime.Text = "00:00";
1136 1159
 
@@ -1229,6 +1252,35 @@ namespace XHWK.WKTool
1229 1252
             //SendKeys.SendWait("%{TAB}");
1230 1253
             MouseEventCommon.MouseMiddleClickEvent(0);
1231 1254
         }
1255
+        bool isToobar = false;
1256
+        /// <summary>
1257
+        /// 在工具条区域内
1258
+        /// </summary>
1259
+        /// <param name="sender"></param>
1260
+        /// <param name="e"></param>
1261
+        private void gridToobarTwo_MouseEnter(object sender, System.Windows.Input.MouseEventArgs e)
1262
+        {
1263
+            isToobar = true;
1264
+        }
1265
+
1266
+        private void gridToobarTwo_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
1267
+        {
1268
+            if(BtnRecordingScreen.ToolTip.ToString().Equals ("暂停")&& gridToobar.Visibility == Visibility.Visible)
1269
+            {
1270
+                if (APP.W_MinToolbar == null)
1271
+                {
1272
+                    APP.W_MinToolbar = new MinToolbar();
1232 1273
 
1274
+                }
1275
+                APP.W_MinToolbar.Initialize(this.Top);
1276
+                //else
1277
+                //{
1278
+                //    APP.W_CountdownWindow.Initialize(true, 1800);
1279
+                //}
1280
+                gridToobar.Visibility = Visibility.Hidden;
1281
+                APP.W_MinToolbar.Show();
1282
+                Console.WriteLine(this.Top+"max");
1283
+            }
1284
+        }
1233 1285
     }
1234 1286
 }

+ 1
- 1
XHWK.WKTool/XHMicroLessonSystemWindow.xaml.cs Zobrazit soubor

@@ -2843,7 +2843,7 @@ namespace XHWK.WKTool
2843 2843
             Graphics graphics = Graphics.FromHwnd(IntPtr.Zero);
2844 2844
             float DIP = graphics.DpiX;
2845 2845
             float DIPY = graphics.DpiY;
2846
-            APP.W_ScreenRecordingToolbarWindow.Left = PrimaryScreen.WorkingArea.Width / (DIP / 96) - APP.W_ScreenRecordingToolbarWindow.Width - 60;
2846
+            APP.W_ScreenRecordingToolbarWindow.Left = PrimaryScreen.WorkingArea.Width / (DIP / 96) - APP.W_ScreenRecordingToolbarWindow.Width+10 ;
2847 2847
             APP.W_ScreenRecordingToolbarWindow.Top = PrimaryScreen.WorkingArea.Height / (DIP / 96) - APP.W_ScreenRecordingToolbarWindow.Height - 30;
2848 2848
             APP.W_ScreenRecordingToolbarWindow.Topmost = true;
2849 2849
             APP.W_ScreenRecordingToolbarWindow.Show();

+ 7
- 0
XHWK.WKTool/XHWK.WKTool.csproj Zobrazit soubor

@@ -161,6 +161,9 @@
161 161
     <Compile Include="MessageWindow.xaml.cs">
162 162
       <DependentUpon>MessageWindow.xaml</DependentUpon>
163 163
     </Compile>
164
+    <Compile Include="MinToolbar.xaml.cs">
165
+      <DependentUpon>MinToolbar.xaml</DependentUpon>
166
+    </Compile>
164 167
     <Compile Include="Models\AppModel.cs" />
165 168
     <Compile Include="Models\Direction.cs" />
166 169
     <Compile Include="Models\EntityBase.cs" />
@@ -224,6 +227,10 @@
224 227
       <SubType>Designer</SubType>
225 228
       <Generator>MSBuild:Compile</Generator>
226 229
     </Page>
230
+    <Page Include="MinToolbar.xaml">
231
+      <Generator>MSBuild:Compile</Generator>
232
+      <SubType>Designer</SubType>
233
+    </Page>
227 234
     <Page Include="PracticeWindow.xaml">
228 235
       <SubType>Designer</SubType>
229 236
       <Generator>MSBuild:Compile</Generator>

Načítá se…
Zrušit
Uložit