[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,18 +99,29 @@
<ColumnDefinition Width="8"/> <ColumnDefinition Width="8"/>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Label Name="LabelID" <DockPanel HorizontalAlignment="Center"
Content="ID" VerticalAlignment="Center"
Canvas.Left="10" Grid.Column="2"
Canvas.Bottom="10" Grid.Row="2">
FontSize="64" <Label
FontWeight="SemiBold" Name="LabelID"
Foreground="{DynamicResource PrimaryForegroundBrush}" DockPanel.Dock="Top"
Grid.Column="2" HorizontalContentAlignment="Center"
Grid.Row="2" VerticalContentAlignment="Center"
VerticalContentAlignment="Center" Content="ID"
HorizontalContentAlignment="Center" /> 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}"/> <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}"/>
<Thumb x:Name="NResize" Cursor="SizeNS" BorderThickness="0,3,0,0" Grid.ColumnSpan="5" DragDelta="UniversalDragDelta" DragStarted="NResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/> <Thumb x:Name="NResize" Cursor="SizeNS" BorderThickness="0,3,0,0" Grid.ColumnSpan="5" DragDelta="UniversalDragDelta" DragStarted="NResize_DragStarted" Style="{DynamicResource CanvasZoneThumbStyle}"/>

View File

@@ -22,6 +22,12 @@ namespace FancyZonesEditor
{ {
InitializeComponent(); InitializeComponent();
Canvas.SetZIndex(this, zIndex++); 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; private CanvasLayoutModel model;

View File

@@ -15,18 +15,27 @@
mc:Ignorable="d"> mc:Ignorable="d">
<Grid x:Name="Frame"> <Grid x:Name="Frame">
<Canvas x:Name="Body" /> <Canvas x:Name="Body" />
<Label <DockPanel HorizontalAlignment="Center"
Name="LabelID" VerticalAlignment="Center">
Grid.Row="3" <Label
Grid.Column="2" Name="LabelID"
Canvas.Left="10" DockPanel.Dock="Top"
Canvas.Bottom="10" HorizontalContentAlignment="Center"
HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
VerticalContentAlignment="Center" Content="ID"
Content="ID" FontWeight="SemiBold"
FontWeight="SemiBold" FontSize="64"
FontSize="64" Foreground="{DynamicResource PrimaryForegroundBrush}" />
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"/>--> <!--<TextBlock Margin="2" Text="Shift Key switches direction&#13;Ctrl Key repeats"/>-->
</Grid> </Grid>
</UserControl> </UserControl>

View File

@@ -73,6 +73,12 @@ namespace FancyZonesEditor
SplitterThickness = Math.Max(spacing, 1); SplitterThickness = Math.Max(spacing, 1);
((App)Application.Current).MainWindowSettings.PropertyChanged += ZoneSettings_PropertyChanged; ((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) private void ZoneSettings_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)