Skip to content

Commit b299a4b

Browse files
committed
为 DanmakuClient 项目添加应用程序图标,并在主窗口中设置图标属性
1 parent 9871c97 commit b299a4b

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

DanmakuClient.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
<UseWPF>true</UseWPF>
99
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1010
<LangVersion>13</LangVersion>
11+
<ApplicationIcon>Resources\Icon.ico</ApplicationIcon>
1112
</PropertyGroup>
1213

1314
<ItemGroup>
@@ -18,4 +19,7 @@
1819
<FrameworkReference Include="Microsoft.WindowsDesktop.App.WindowsForms"/>
1920
</ItemGroup>
2021

22+
<ItemGroup>
23+
<Resource Include="Resources\Icon.ico" />
24+
</ItemGroup>
2125
</Project>

MainWindow.xaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
mc:Ignorable="d"
77
Title="弹幕客户端"
8+
Icon="Resources/Icon.ico"
89
SizeToContent="WidthAndHeight"
910
MinWidth="300"
1011
Background="White"
@@ -119,7 +120,9 @@
119120
</Grid>
120121
</GroupBox>
121122

122-
<Button Content="确认"
123+
<Button x:Name="ConfirmButton"
124+
Content="确认"
125+
IsDefault="True"
123126
Click="OnConfirmClick" />
124127
</StackPanel>
125128
</Window>

MainWindow.xaml.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,7 @@ private static bool TryParsePercentage(string input, out double percentage) {
9292
}
9393

9494
private void OnTitleBarMouseLeftButtonDown(object sender, MouseButtonEventArgs e) {
95-
if (e.ButtonState == MouseButtonState.Pressed) {
96-
DragMove();
97-
}
95+
if (e.ButtonState == MouseButtonState.Pressed) DragMove();
9896
}
9997

10098
private void OnCloseButtonClick(object sender, RoutedEventArgs e) {

Resources/Icon.ico

61.6 KB
Binary file not shown.

0 commit comments

Comments
 (0)