Skip to content

Commit 6631e6f

Browse files
committed
update Windows color pickup
1 parent df5a1ab commit 6631e6f

File tree

3 files changed

+114
-60
lines changed

3 files changed

+114
-60
lines changed

Nimble/ViewModels/MainVM.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,8 @@ private void MouseHook_MouseDown(object sender, MouseEventArgs e)
509509
{
510510
_timer.Stop();
511511
mouseHook.Stop();
512-
if (colorView != null) colorView.Close();
512+
if (colorView != null)
513+
colorView.Close();
513514
}
514515
}
515516

Nimble/Views/StartView.xaml

Lines changed: 71 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,78 @@
1-
<Window x:Class="Nimble.Views.StartView"
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:shell="https://github.com/WPFDevelopersOrg/WPFDevelopers"
7-
xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
8-
xmlns:local="clr-namespace:Nimble.Views"
9-
mc:Ignorable="d"
10-
Title="启动页" Height="320" Width="500"
11-
ResizeMode="NoResize" WindowStartupLocation="CenterScreen"
12-
Background="#00FFFFFF" WindowStyle="None"
13-
TextOptions.TextFormattingMode="Display" UseLayoutRounding="True"
14-
SnapsToDevicePixels="True" x:Name="mainView" ShowInTaskbar="False">
1+
<Window
2+
x:Class="Nimble.Views.StartView"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:Nimble.Views"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
9+
xmlns:shell="https://github.com/WPFDevelopersOrg/WPFDevelopers"
10+
x:Name="mainView"
11+
Title="启动页"
12+
Width="500"
13+
Height="320"
14+
Background="#00FFFFFF"
15+
ResizeMode="NoResize"
16+
ShowInTaskbar="False"
17+
SnapsToDevicePixels="True"
18+
TextOptions.TextFormattingMode="Display"
19+
UseLayoutRounding="True"
20+
WindowStartupLocation="CenterScreen"
21+
WindowStyle="None"
22+
mc:Ignorable="d">
1523
<shell:WindowChrome.WindowChrome>
16-
<shell:WindowChrome GlassFrameThickness="-1"
17-
CaptionHeight="{Binding ElementName=mainView,Path=ActualHeight}"/>
24+
<shell:WindowChrome CaptionHeight="{Binding ElementName=mainView, Path=ActualHeight}" GlassFrameThickness="-1" />
1825
</shell:WindowChrome.WindowChrome>
1926
<Window.Resources>
20-
<ImageBrush x:Key="freeMachineImageBrush"
21-
ImageSource="/Nimble;component/Images/airplane.png"
22-
Stretch="None" AlignmentY="Center"
23-
po:Freeze="True"/>
27+
<ImageBrush
28+
x:Key="freeMachineImageBrush"
29+
po:Freeze="True"
30+
AlignmentY="Center"
31+
ImageSource="/Nimble;component/Images/airplane.png"
32+
Stretch="None" />
2433
</Window.Resources>
2534
<Canvas Name="myCanvas" Focusable="True">
26-
<Rectangle Name="background" Height="320" Width="1262"/>
27-
<Rectangle Name="background2" Height="320" Width="1262" Canvas.Left="1262"/>
28-
<Rectangle x:Name="freeRect" Fill="{StaticResource freeMachineImageBrush}"
29-
Height="48" Width="128" Canvas.Left="186" Canvas.Top="20"/>
30-
<TextBlock x:Name="tbMsg" FontSize="20" Canvas.Left="10" />
31-
<TextBlock x:Name="tb1" Text="8866 微信公众号:WPF开发者" FontSize="20" Canvas.Left="100" Canvas.Top="120" Width="1262"/>
32-
<TextBlock x:Name="tb2" Text="2333哈哈哈哈" FontSize="20" Canvas.Left="800" Canvas.Top="80" Width="1262"/>
33-
<TextBlock x:Name="tb3" Text="66666 再接再厉" FontSize="20" Canvas.Left="450" Canvas.Top="160" Width="1262"/>
34-
<!-- Canvas.Left="122"-->
35+
<Rectangle
36+
Name="background"
37+
Width="1262"
38+
Height="320" />
39+
<Rectangle
40+
Name="background2"
41+
Canvas.Left="1262"
42+
Width="1262"
43+
Height="320" />
44+
<Rectangle
45+
x:Name="freeRect"
46+
Canvas.Left="186"
47+
Canvas.Top="20"
48+
Width="128"
49+
Height="48"
50+
Fill="{StaticResource freeMachineImageBrush}" />
51+
<TextBlock
52+
x:Name="tbMsg"
53+
Canvas.Left="10"
54+
FontSize="20" />
55+
<TextBlock
56+
x:Name="tb1"
57+
Canvas.Left="100"
58+
Canvas.Top="120"
59+
Width="1262"
60+
FontSize="20"
61+
Text="8866 微信公众号:WPF开发者" />
62+
<TextBlock
63+
x:Name="tb2"
64+
Canvas.Left="800"
65+
Canvas.Top="80"
66+
Width="1262"
67+
FontSize="20"
68+
Text="2333哈哈哈哈" />
69+
<TextBlock
70+
x:Name="tb3"
71+
Canvas.Left="450"
72+
Canvas.Top="160"
73+
Width="1262"
74+
FontSize="20"
75+
Text="66666 再接再厉" />
76+
<!-- Canvas.Left="122" -->
3577
</Canvas>
3678
</Window>

Nimble/Views/WindowColor.xaml

Lines changed: 41 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,49 @@
1-
<Window x:Class="Nimble.Views.WindowColor"
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:Nimble.Views"
7-
xmlns:shell="https://github.com/WPFDevelopersOrg/WPFDevelopers"
8-
mc:Ignorable="d"
9-
Title="WindowColor"
10-
UseLayoutRounding="True"
11-
ResizeMode="NoResize"
12-
Height="60"
13-
SizeToContent="Width"
14-
SnapsToDevicePixels="True" WindowStyle="None"
15-
Background="Transparent"
16-
Topmost="True"
17-
ShowInTaskbar="False">
1+
<Window
2+
x:Class="Nimble.Views.WindowColor"
3+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
4+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
5+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6+
xmlns:local="clr-namespace:Nimble.Views"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:shell="https://github.com/WPFDevelopersOrg/WPFDevelopers"
9+
Title="WindowColor"
10+
Height="60"
11+
Background="Transparent"
12+
ResizeMode="NoResize"
13+
ShowInTaskbar="False"
14+
SizeToContent="Width"
15+
SnapsToDevicePixels="True"
16+
Topmost="True"
17+
UseLayoutRounding="True"
18+
WindowStyle="None"
19+
mc:Ignorable="d">
1820
<shell:WindowChrome.WindowChrome>
19-
<shell:WindowChrome GlassFrameThickness="-1" CaptionHeight="0"/>
21+
<shell:WindowChrome CaptionHeight="0" GlassFrameThickness="-1" />
2022
</shell:WindowChrome.WindowChrome>
21-
<Border Grid.ColumnSpan="2" Margin="10"
22-
CornerRadius="4"
23-
Background="{StaticResource BaseSolidColorBrush}"
24-
Effect="{StaticResource NormalShadowDepth}">
23+
<Border
24+
Grid.ColumnSpan="2"
25+
Margin="10"
26+
Background="{StaticResource WD.BaseSolidColorBrush}"
27+
CornerRadius="4"
28+
Effect="{StaticResource NormalShadowDepth}">
2529
<Grid Height="30">
2630
<Grid.ColumnDefinitions>
27-
<ColumnDefinition Width="40"/>
28-
<ColumnDefinition Width="Auto"/>
31+
<ColumnDefinition Width="40" />
32+
<ColumnDefinition Width="Auto" />
2933
</Grid.ColumnDefinitions>
30-
<Rectangle Grid.Column="0" RadiusX="4" RadiusY="4" Margin="4"
31-
Fill="{Binding MouseColor,RelativeSource={RelativeSource AncestorType={x:Type local:WindowColor}}}"/>
32-
<TextBlock Grid.Column="1" VerticalAlignment="Center"
33-
FontWeight="Black" Margin="4,0,6,0"
34-
FontSize="14"
35-
Text="{Binding MouseColorText,RelativeSource={RelativeSource AncestorType={x:Type local:WindowColor}}}"/>
34+
<Rectangle
35+
Grid.Column="0"
36+
Margin="4"
37+
Fill="{Binding MouseColor, RelativeSource={RelativeSource AncestorType={x:Type local:WindowColor}}}"
38+
RadiusX="4"
39+
RadiusY="4" />
40+
<TextBlock
41+
Grid.Column="1"
42+
Margin="4,0,6,0"
43+
VerticalAlignment="Center"
44+
FontSize="14"
45+
FontWeight="Black"
46+
Text="{Binding MouseColorText, RelativeSource={RelativeSource AncestorType={x:Type local:WindowColor}}}" />
3647
<!--<Border Background="White" Effect="{StaticResource NormalShadowDepth}" CornerRadius="40"/>
3748
<Ellipse Fill="{Binding MouseColor,RelativeSource={RelativeSource AncestorType={x:Type local:WindowColor}}}"
3849
Stroke="Transparent" StrokeThickness="8"/>-->

0 commit comments

Comments
 (0)