mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[FZ Editor] Show zone size below the zone index (#9449)
This commit is contained in:
@@ -99,17 +99,28 @@
|
||||
<ColumnDefinition Width="8"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Name="LabelID"
|
||||
Content="ID"
|
||||
Canvas.Left="10"
|
||||
Canvas.Bottom="10"
|
||||
FontSize="64"
|
||||
FontWeight="SemiBold"
|
||||
Foreground="{DynamicResource PrimaryForegroundBrush}"
|
||||
Grid.Column="2"
|
||||
Grid.Row="2"
|
||||
VerticalContentAlignment="Center"
|
||||
HorizontalContentAlignment="Center" />
|
||||
<DockPanel HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Grid.Column="2"
|
||||
Grid.Row="2">
|
||||
<Label
|
||||
Name="LabelID"
|
||||
DockPanel.Dock="Top"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Content="ID"
|
||||
FontWeight="SemiBold"
|
||||
FontSize="64"
|
||||
Foreground="{DynamicResource PrimaryForegroundBrush}" />
|
||||
<Label
|
||||
Name="LabelSize"
|
||||
DockPanel.Dock="Bottom"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
FontWeight="Thin"
|
||||
FontSize="32"
|
||||
Foreground="{DynamicResource PrimaryForegroundBrush}" />
|
||||
</DockPanel>
|
||||
|
||||
<Thumb x:Name="Caption" Cursor="SizeAll" Background="Transparent" BorderThickness="3" Padding="4" Grid.Column="0" Grid.ColumnSpan="5" Grid.Row="0" Grid.RowSpan="5" DragDelta="UniversalDragDelta" DragStarted="Caption_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/>
|
||||
|
||||
|
||||
@@ -22,6 +22,12 @@ namespace FancyZonesEditor
|
||||
{
|
||||
InitializeComponent();
|
||||
Canvas.SetZIndex(this, zIndex++);
|
||||
SizeChanged += CanvasZone_SizeChanged;
|
||||
}
|
||||
|
||||
private void CanvasZone_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
LabelSize.Content = "(" + Width.ToString() + "x" + Height.ToString() + ")";
|
||||
}
|
||||
|
||||
private CanvasLayoutModel model;
|
||||
|
||||
@@ -15,18 +15,27 @@
|
||||
mc:Ignorable="d">
|
||||
<Grid x:Name="Frame">
|
||||
<Canvas x:Name="Body" />
|
||||
<Label
|
||||
Name="LabelID"
|
||||
Grid.Row="3"
|
||||
Grid.Column="2"
|
||||
Canvas.Left="10"
|
||||
Canvas.Bottom="10"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Content="ID"
|
||||
FontWeight="SemiBold"
|
||||
FontSize="64"
|
||||
Foreground="{DynamicResource PrimaryForegroundBrush}" />
|
||||
<DockPanel HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center">
|
||||
<Label
|
||||
Name="LabelID"
|
||||
DockPanel.Dock="Top"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
Content="ID"
|
||||
FontWeight="SemiBold"
|
||||
FontSize="64"
|
||||
Foreground="{DynamicResource PrimaryForegroundBrush}" />
|
||||
<Label
|
||||
Name="LabelSize"
|
||||
DockPanel.Dock="Bottom"
|
||||
HorizontalContentAlignment="Center"
|
||||
VerticalContentAlignment="Center"
|
||||
FontWeight="Thin"
|
||||
FontSize="32"
|
||||
Foreground="{DynamicResource PrimaryForegroundBrush}" />
|
||||
|
||||
</DockPanel>
|
||||
<!--<TextBlock Margin="2" Text="Shift Key switches direction Ctrl Key repeats"/>-->
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
||||
@@ -73,6 +73,12 @@ namespace FancyZonesEditor
|
||||
SplitterThickness = Math.Max(spacing, 1);
|
||||
|
||||
((App)Application.Current).MainWindowSettings.PropertyChanged += ZoneSettings_PropertyChanged;
|
||||
SizeChanged += GridZone_SizeChanged;
|
||||
}
|
||||
|
||||
private void GridZone_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
LabelSize.Content = "(" + Math.Round(ActualWidth).ToString() + "x" + Math.Round(ActualHeight).ToString() + ")";
|
||||
}
|
||||
|
||||
private void ZoneSettings_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user