我目前正在嘗試製作一種程序,它在踢入實際程序本身之前具有一種啓動屏幕。我決定使用wpf作爲程序,因此,啓動屏幕必須用XAML編寫。我有種訣竅,但是我試圖縮放從互聯網上下載的字體時遇到了問題。看起來縮放只適用於內置和/或系統字體。有沒有一種方法可以調整它呢?每次我嘗試將它放在視圖框內的方法都會縮小一切。我嘗試用Calibri替換所有文本,看看它是否能修復它,並且確實如此。但是,要清楚,我不想使用Calibri或任何其他內置字體,除非它真的是「乾淨」的。對於任何人想知道的,這個字體被稱爲Gidole。謝謝。這裏是XAML代碼:如何在wpf中縮放非內置/自定義字體C#
<Window x:Name="StartPage" x:Class="ModernBoard.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ModernBoard"
mc:Ignorable="d"
Title="ModernBoard Welcome Page" ShowInTaskbar="False" ResizeMode="NoResize" WindowStartupLocation="CenterScreen" Background="#FF191919" Foreground="#FFE6E6E6" HorizontalAlignment="Center" VerticalAlignment="Center" ScrollViewer.VerticalScrollBarVisibility="Disabled" FontFamily="Gidole" SnapsToDevicePixels="True" Height="260.301" Width="653.627" FontStretch="Expanded">
<Viewbox HorizontalAlignment="Left" Height="231" VerticalAlignment="Top" Width="648" Stretch="None">
<Grid>
<Label x:Name="WelcomeTo" Content="Welcome to" HorizontalAlignment="Left" Margin="38,27,0,0" VerticalAlignment="Top" Width="82" Height="27" FontFamily="Gidole" FontWeight="Bold" Foreground="#FFE6E6E6"/>
<Label x:Name="Modern" Content="Modern" HorizontalAlignment="Left" Margin="37,36,0,0" VerticalAlignment="Top" Width="356" Height="120" FontSize="90" Foreground="#FFE6E6E6" FontFamily="Gidole" FontWeight="Thin"/>
<Label x:Name="Board" Content="Board" HorizontalAlignment="Left" Margin="336,36,0,0" VerticalAlignment="Top" Width="265" Height="120" FontSize="90" Foreground="#FFE6E6E6" FontFamily="Gidole" FontWeight="Bold"/>
<Button x:Name="New" Content="New Board" HorizontalAlignment="Left" Margin="44,135,0,0" VerticalAlignment="Top" Width="272" FontWeight="DemiBold" Foreground="#FFE6E6E6" Background="#2c406e" BorderThickness="0" Height="24"/>
<Button x:Name="Open" Content="Open Board" HorizontalAlignment="Left" Margin="329,135,0,0" VerticalAlignment="Top" Width="272" FontWeight="DemiBold" Foreground="#FFE6E6E6" Background="#2c406e" BorderThickness="0" Height="24"/>
<Button x:Name="Import" Content="Import File" HorizontalAlignment="Left" Margin="44,168,0,0" VerticalAlignment="Top" Width="557" FontWeight="DemiBold" Foreground="#FFE6E6E6" Background="#2c406e" BorderThickness="0" Height="24"/>
</Grid>
</Viewbox>
</Window>
這裏是預覽截圖:Preview
這裏是程序看起來像什麼,運行時:提前Running
感謝,
Alex Fanat
我試過你的建議,但它仍然無法正常工作。我認爲你誤解了這個問題;我希望實際的程序看起來像它在預覽中的樣子,目前它沒有。當我運行程序時,兩個標籤都縮小了,字體權重也不能正確顯示。 –