Skip to content

Commit

Permalink
为 DanmakuClient 项目添加应用程序图标,并在主窗口中设置图标属性
Browse files Browse the repository at this point in the history
  • Loading branch information
Wybxc committed Jan 14, 2025
1 parent 9871c97 commit b299a4b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
4 changes: 4 additions & 0 deletions DanmakuClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<UseWPF>true</UseWPF>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>13</LangVersion>
<ApplicationIcon>Resources\Icon.ico</ApplicationIcon>
</PropertyGroup>

<ItemGroup>
Expand All @@ -18,4 +19,7 @@
<FrameworkReference Include="Microsoft.WindowsDesktop.App.WindowsForms"/>
</ItemGroup>

<ItemGroup>
<Resource Include="Resources\Icon.ico" />
</ItemGroup>
</Project>
5 changes: 4 additions & 1 deletion MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Title="弹幕客户端"
Icon="Resources/Icon.ico"
SizeToContent="WidthAndHeight"
MinWidth="300"
Background="White"
Expand Down Expand Up @@ -119,7 +120,9 @@
</Grid>
</GroupBox>

<Button Content="确认"
<Button x:Name="ConfirmButton"
Content="确认"
IsDefault="True"
Click="OnConfirmClick" />
</StackPanel>
</Window>
4 changes: 1 addition & 3 deletions MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,7 @@ private static bool TryParsePercentage(string input, out double percentage) {
}

private void OnTitleBarMouseLeftButtonDown(object sender, MouseButtonEventArgs e) {
if (e.ButtonState == MouseButtonState.Pressed) {
DragMove();
}
if (e.ButtonState == MouseButtonState.Pressed) DragMove();
}

private void OnCloseButtonClick(object sender, RoutedEventArgs e) {
Expand Down
Binary file added Resources/Icon.ico
Binary file not shown.

0 comments on commit b299a4b

Please sign in to comment.