[FZ Editor] Show zone size below the zone index (#9449)

This commit is contained in:
Seraphima Zykova
2021-02-03 20:15:16 +03:00
committed by GitHub
parent 4bba8bc173
commit c7b6e51eba
4 changed files with 56 additions and 24 deletions

View File

@@ -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}"/>

View File

@@ -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;

View File

@@ -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&#13;Ctrl Key repeats"/>-->
</Grid>
</UserControl>

View File

@@ -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)