mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2026-08-09 17:41:14 +10:00
fix: make tweak/feature link (?) follow font scaling (#4700)
* Update Invoke-WPFUIElements.ps1 * Update Invoke-WPFUIElements.ps1 * Update Invoke-WPFUIElements.ps1 Update Invoke-WPFUIElements.ps1 * Fix tweak link margin scaling --------- Co-authored-by: Chris Titus <contact@christitus.com>
This commit is contained in:
co-authored by
Chris Titus
parent
8147903ff2
commit
27e590577b
@@ -404,6 +404,27 @@ function Invoke-WPFUIElements {
|
|||||||
$textBlock.ToolTip = $entryInfo.Link
|
$textBlock.ToolTip = $entryInfo.Link
|
||||||
$textBlock.Style = $HoverTextBlockStyle
|
$textBlock.Style = $HoverTextBlockStyle
|
||||||
$textBlock.UseLayoutRounding = $true
|
$textBlock.UseLayoutRounding = $true
|
||||||
|
|
||||||
|
$textBlock.VerticalAlignment = "Center"
|
||||||
|
$textBlock.SetResourceReference([Windows.Controls.Control]::FontSizeProperty, "FontSize")
|
||||||
|
$textBlock.Tag = $checkBox
|
||||||
|
|
||||||
|
$updateLinkMargin = {
|
||||||
|
[System.Object]$Sender = $args[0]
|
||||||
|
$linkedCheckBox = $Sender.Tag
|
||||||
|
$MarginTopBase = if ($linkedCheckBox) { $linkedCheckBox.Margin.Top } else { 0 }
|
||||||
|
$Sender.Margin = New-Object Windows.Thickness(
|
||||||
|
[math]::Round($Sender.FontSize * 0.5),
|
||||||
|
($MarginTopBase - [math]::Round($Sender.FontSize / 2)),
|
||||||
|
0, 0
|
||||||
|
)
|
||||||
|
}
|
||||||
|
$textBlock.Add_Loaded($updateLinkMargin)
|
||||||
|
$fontSizeDescriptor = [System.ComponentModel.DependencyPropertyDescriptor]::FromProperty(
|
||||||
|
[Windows.Controls.Control]::FontSizeProperty,
|
||||||
|
[Windows.Controls.TextBlock]
|
||||||
|
)
|
||||||
|
$fontSizeDescriptor.AddValueChanged($textBlock, $updateLinkMargin)
|
||||||
|
|
||||||
$horizontalStackPanel.Children.Add($textBlock) | Out-Null
|
$horizontalStackPanel.Children.Add($textBlock) | Out-Null
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user