A:调整小窗样式;调整默认位置
This commit is contained in:
1 parent
c8eecedf2d
commit
6f2418af7b
2 files changed
+116
-109
No files matched your search
@@ -41,6 +41,7 @@ public partial class NetView : Window
|
||||
public NetView()
|
||||
{
|
||||
InitializeComponent();
|
||||
Loaded += OnLoaded;
|
||||
InitializeTrayIcon();
|
||||
this.Loaded += NetView_Loaded;
|
||||
|
||||
@@ -51,6 +52,12 @@ public partial class NetView : Window
|
||||
InitializeDoubleClickTimer();
|
||||
}
|
||||
|
||||
private void OnLoaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// 重置位置
|
||||
ResetToDefaultPosition();
|
||||
}
|
||||
|
||||
private void NetView_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Initialize default position if needed
|
||||
@@ -285,7 +292,7 @@ public partial class NetView : Window
|
||||
private void ResetToDefaultPosition()
|
||||
{
|
||||
var workArea = SystemParameters.WorkArea;
|
||||
this.Left = workArea.Right - this.Width - 20;
|
||||
this.Left = workArea.Right - this.Width - 50;
|
||||
this.Top = workArea.Top + 20;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,179 +7,179 @@
|
||||
mc:Ignorable="d"
|
||||
Title="NetVizor - 设置"
|
||||
Height="480"
|
||||
Width="420"
|
||||
Width="470"
|
||||
MinHeight="480"
|
||||
MinWidth="420"
|
||||
MinWidth="470"
|
||||
MaxHeight="480"
|
||||
MaxWidth="420"
|
||||
MaxWidth="470"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
ResizeMode="NoResize">
|
||||
|
||||
|
||||
<!-- 主容器 -->
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<!-- 内容区域 -->
|
||||
<Grid Grid.Row="0" Margin="20,20,20,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="16"/>
|
||||
<ColumnDefinition Width="140"/>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="16" />
|
||||
<ColumnDefinition Width="180" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
<!-- 左侧设置区 -->
|
||||
<StackPanel Grid.Column="0">
|
||||
|
||||
|
||||
<!-- 外观 -->
|
||||
<TextBlock Text="外观" FontSize="14" FontWeight="Bold" Margin="0,0,0,12"/>
|
||||
<TextBlock Text="外观" FontSize="14" FontWeight="Bold" Margin="0,0,0,12" />
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="8"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="8"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="8" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="8" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="32"/>
|
||||
<ColumnDefinition Width="80" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="32" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
<!-- 文字颜色 -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="文字颜色" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" x:Name="TextColorBox" Text="#333333"
|
||||
Margin="0,0,8,0"/>
|
||||
<Button Grid.Row="0" Grid.Column="2" x:Name="TextColorButton" Background="#333333"
|
||||
Width="24" Height="24" Click="SelectTextColor_Click"/>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="文字颜色" VerticalAlignment="Center" />
|
||||
<TextBox Grid.Row="0" Grid.Column="1" x:Name="TextColorBox" Text="#333333"
|
||||
Margin="0,0,8,0" />
|
||||
<Button Grid.Row="0" Grid.Column="2" x:Name="TextColorButton" Background="#333333"
|
||||
Width="24" Height="24" Click="SelectTextColor_Click" />
|
||||
|
||||
<!-- 背景颜色 -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="背景颜色" VerticalAlignment="Center"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="1" x:Name="BackgroundColorBox" Text="#F0FFFFFF"
|
||||
Margin="0,0,8,0"/>
|
||||
<Button Grid.Row="2" Grid.Column="2" x:Name="BackgroundColorButton" Background="#F0FFFFFF"
|
||||
Width="24" Height="24" Click="SelectBackgroundColor_Click"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="背景颜色" VerticalAlignment="Center" />
|
||||
<TextBox Grid.Row="2" Grid.Column="1" x:Name="BackgroundColorBox" Text="#F0FFFFFF"
|
||||
Margin="0,0,8,0" />
|
||||
<Button Grid.Row="2" Grid.Column="2" x:Name="BackgroundColorButton" Background="#F0FFFFFF"
|
||||
Width="24" Height="24" Click="SelectBackgroundColor_Click" />
|
||||
|
||||
<!-- 透明度 -->
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Text="透明度" VerticalAlignment="Center"/>
|
||||
<Slider Grid.Row="4" Grid.Column="1" x:Name="OpacitySlider" Minimum="10" Maximum="100"
|
||||
Value="94" TickFrequency="10" IsSnapToTickEnabled="True"
|
||||
ValueChanged="OpacitySlider_ValueChanged" Margin="0,0,8,0"/>
|
||||
<TextBlock Grid.Row="4" Grid.Column="2" x:Name="OpacityText" Text="94%"
|
||||
TextAlignment="Center" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Text="透明度" VerticalAlignment="Center" />
|
||||
<Slider Grid.Row="4" Grid.Column="1" x:Name="OpacitySlider" Minimum="10" Maximum="100"
|
||||
Value="94" TickFrequency="10" IsSnapToTickEnabled="True"
|
||||
ValueChanged="OpacitySlider_ValueChanged" Margin="0,0,8,0" />
|
||||
<TextBlock Grid.Row="4" Grid.Column="2" x:Name="OpacityText" Text="94%"
|
||||
TextAlignment="Center" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
|
||||
|
||||
<!-- 显示 -->
|
||||
<TextBlock Text="显示" FontSize="14" FontWeight="Bold" Margin="0,0,0,12"/>
|
||||
<TextBlock Text="显示" FontSize="14" FontWeight="Bold" Margin="0,0,0,12" />
|
||||
<Grid Margin="0,0,0,16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="8"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="8"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="8" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="8" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="80" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
|
||||
<!-- 速度单位 -->
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="速度单位" VerticalAlignment="Center"/>
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" x:Name="SpeedUnitComboBox"
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="速度单位" VerticalAlignment="Center" />
|
||||
<ComboBox Grid.Row="0" Grid.Column="1" x:Name="SpeedUnitComboBox"
|
||||
SelectionChanged="SpeedUnitComboBox_SelectionChanged">
|
||||
<ComboBoxItem Content="自动选择" Tag="Auto" IsSelected="True"/>
|
||||
<ComboBoxItem Content="B/s" Tag="Bytes"/>
|
||||
<ComboBoxItem Content="KB/s" Tag="KB"/>
|
||||
<ComboBoxItem Content="MB/s" Tag="MB"/>
|
||||
<ComboBoxItem Content="自动选择" Tag="Auto" IsSelected="True" />
|
||||
<ComboBoxItem Content="B/s" Tag="Bytes" />
|
||||
<ComboBoxItem Content="KB/s" Tag="KB" />
|
||||
<ComboBoxItem Content="MB/s" Tag="MB" />
|
||||
</ComboBox>
|
||||
|
||||
|
||||
<!-- 布局方向 -->
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="布局方向" VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="布局方向" VerticalAlignment="Center" />
|
||||
<StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal">
|
||||
<RadioButton x:Name="VerticalLayoutRadio" Content="纵向" IsChecked="True"
|
||||
Margin="0,0,20,0" Checked="LayoutDirection_Changed"/>
|
||||
<RadioButton x:Name="HorizontalLayoutRadio" Content="横向"
|
||||
Checked="LayoutDirection_Changed"/>
|
||||
<RadioButton x:Name="VerticalLayoutRadio" Content="纵向" IsChecked="True"
|
||||
Margin="0,0,20,0" Checked="LayoutDirection_Changed" />
|
||||
<RadioButton x:Name="HorizontalLayoutRadio" Content="横向"
|
||||
Checked="LayoutDirection_Changed" />
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<!-- 显示单位 -->
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Text="显示选项" VerticalAlignment="Center"/>
|
||||
<CheckBox Grid.Row="4" Grid.Column="1" x:Name="ShowUnitCheckBox" Content="显示单位"
|
||||
IsChecked="True" Checked="ShowUnitCheckBox_Changed"
|
||||
Unchecked="ShowUnitCheckBox_Changed"/>
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Text="显示选项" VerticalAlignment="Center" />
|
||||
<CheckBox Grid.Row="4" Grid.Column="1" x:Name="ShowUnitCheckBox" Content="显示单位"
|
||||
IsChecked="True" Checked="ShowUnitCheckBox_Changed"
|
||||
Unchecked="ShowUnitCheckBox_Changed" />
|
||||
</Grid>
|
||||
|
||||
|
||||
<!-- 交互 -->
|
||||
<TextBlock Text="交互" FontSize="14" FontWeight="Bold" Margin="0,0,0,12"/>
|
||||
<TextBlock Text="交互" FontSize="14" FontWeight="Bold" Margin="0,0,0,12" />
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="80" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Grid.Column="0" Text="双击动作" VerticalAlignment="Center"/>
|
||||
<ComboBox Grid.Column="1" x:Name="DoubleClickActionComboBox"
|
||||
|
||||
<TextBlock Grid.Column="0" Text="双击动作" VerticalAlignment="Center" />
|
||||
<ComboBox Grid.Column="1" x:Name="DoubleClickActionComboBox"
|
||||
SelectionChanged="DoubleClickActionComboBox_SelectionChanged">
|
||||
<ComboBoxItem Content="无动作" Tag="None" IsSelected="True"/>
|
||||
<ComboBoxItem Content="流量分析" Tag="TrafficAnalysis"/>
|
||||
<ComboBoxItem Content="打开设置" Tag="Settings"/>
|
||||
<ComboBoxItem Content="无动作" Tag="None" IsSelected="True" />
|
||||
<ComboBoxItem Content="流量分析" Tag="TrafficAnalysis" />
|
||||
<ComboBoxItem Content="打开设置" Tag="Settings" />
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
<!-- 右侧预览区 -->
|
||||
<StackPanel Grid.Column="2">
|
||||
<TextBlock Text="预览" FontSize="14" FontWeight="Bold" Margin="0,0,0,12"/>
|
||||
|
||||
<Border HorizontalAlignment="Center" x:Name="PreviewBorder"
|
||||
Background="LightGray" BorderBrush="Gray" BorderThickness="1"
|
||||
<TextBlock Text="预览" FontSize="14" FontWeight="Bold" Margin="0,0,0,12" />
|
||||
|
||||
<Border HorizontalAlignment="Center" x:Name="PreviewBorder"
|
||||
Background="LightGray" BorderBrush="Gray" BorderThickness="1"
|
||||
Padding="16,12">
|
||||
|
||||
<StackPanel x:Name="PreviewPanel" Orientation="Vertical">
|
||||
|
||||
<StackPanel x:Name="PreviewPanel" Orientation="Horizontal">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="↑" Foreground="Red" FontSize="11"
|
||||
FontWeight="Bold" VerticalAlignment="Center" Margin="0,0,6,0"/>
|
||||
<TextBlock Grid.Column="1" x:Name="PreviewUploadText" Text="1.25 MB/s"
|
||||
FontSize="11" FontWeight="Bold"
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="0" Text="↑" Foreground="Red" FontSize="11"
|
||||
FontWeight="Bold" VerticalAlignment="Center" Margin="0,0,6,0" />
|
||||
<TextBlock Grid.Column="1" x:Name="PreviewUploadText" Text="1.25 MB/s"
|
||||
FontSize="11" FontWeight="Bold"
|
||||
VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
<Grid Margin="0,4,0,0">
|
||||
<Grid Margin="0,0,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Grid.Column="0" Text="↓" Foreground="Green" FontSize="11"
|
||||
FontWeight="Bold" VerticalAlignment="Center" Margin="0,0,6,0"/>
|
||||
<TextBlock Grid.Column="1" x:Name="PreviewDownloadText" Text="15.67 MB/s"
|
||||
FontSize="11" FontWeight="Bold"
|
||||
VerticalAlignment="Center"/>
|
||||
<TextBlock Grid.Column="0" Text="↓" Foreground="Green" FontSize="11"
|
||||
FontWeight="Bold" VerticalAlignment="Center" Margin="0,0,2,0" />
|
||||
<TextBlock Grid.Column="1" x:Name="PreviewDownloadText" Text="15.67 MB/s"
|
||||
FontSize="11" FontWeight="Bold"
|
||||
VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
|
||||
|
||||
<!-- 底部按钮 -->
|
||||
<Border Grid.Row="1" Background="LightGray" Padding="20,12">
|
||||
<Grid>
|
||||
<Button HorizontalAlignment="Left" Content="恢复默认" Click="RestoreDefaults_Click"
|
||||
Padding="12,6" MinWidth="80"/>
|
||||
<Button HorizontalAlignment="Left" Content="恢复默认" Click="RestoreDefaults_Click"
|
||||
Padding="12,6" MinWidth="80" />
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
|
||||
<Button Content="应用" Click="Apply_Click" Margin="0,0,8,0"
|
||||
Padding="16,6" MinWidth="60" FontWeight="SemiBold"/>
|
||||
<Button Content="关闭" Click="Close_Click"
|
||||
Padding="12,6" MinWidth="60"/>
|
||||
<Button Content="应用" Click="Apply_Click" Margin="0,0,8,0"
|
||||
Padding="16,6" MinWidth="60" FontWeight="SemiBold" />
|
||||
<Button Content="关闭" Click="Close_Click"
|
||||
Padding="12,6" MinWidth="60" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
</Window>
|
||||
Reference in new issue
Block a user