131 lines
4.9 KiB
XML
131 lines
4.9 KiB
XML
<ms:MelWindow
|
|
x:Class="ShrlAlgoStudio.Iconfont2CSharpView"
|
|
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:local="clr-namespace:ShrlAlgoStudio"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:ms="https://github.com/ShrlAlgo/Melskin"
|
|
Title="字体转C#"
|
|
Width="800"
|
|
Height="450"
|
|
mc:Ignorable="d">
|
|
<Grid Margin="15">
|
|
<Grid.RowDefinitions>
|
|
<RowDefinition Height="Auto" />
|
|
<RowDefinition Height="*" />
|
|
</Grid.RowDefinitions>
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="3*" />
|
|
<ColumnDefinition Width="2*" />
|
|
</Grid.ColumnDefinitions>
|
|
|
|
<!-- 顶部工具栏 -->
|
|
<Border
|
|
Grid.Row="0"
|
|
Grid.ColumnSpan="2"
|
|
Margin="0,0,0,15"
|
|
Padding="0,0,0,15"
|
|
BorderBrush="#DDDDDD"
|
|
BorderThickness="0,0,0,1">
|
|
<StackPanel Orientation="Vertical">
|
|
<StackPanel Orientation="Horizontal">
|
|
<Button
|
|
Padding="15,8"
|
|
Background="#007ACC"
|
|
Click="OnLoadFontClick"
|
|
Content="1. 加载字体文件 (.ttf / .otf)"
|
|
FontWeight="Bold"
|
|
Foreground="White" />
|
|
<Button
|
|
Margin="10,0,0,0"
|
|
Padding="15,8"
|
|
Background="#444"
|
|
Click="OnLoadCssClick"
|
|
Content="2. (可选) 加载 CSS 映射名称"
|
|
Foreground="White" />
|
|
<CheckBox
|
|
x:Name="ChkGenerateEnum"
|
|
Margin="20,0,0,0"
|
|
VerticalAlignment="Center"
|
|
Content="生成 Enum 而非 String" />
|
|
</StackPanel>
|
|
<TextBlock
|
|
x:Name="TxtStatus"
|
|
Margin="5,10,0,0"
|
|
Foreground="Gray"
|
|
Text="请先加载字体文件..." />
|
|
</StackPanel>
|
|
</Border>
|
|
|
|
<!-- 左侧:图标预览列表 -->
|
|
<GroupBox
|
|
Grid.Row="1"
|
|
Grid.Column="0"
|
|
Margin="0,0,10,0"
|
|
Header="图标预览">
|
|
<DataGrid
|
|
x:Name="GridIcons"
|
|
AutoGenerateColumns="False"
|
|
CanUserAddRows="False"
|
|
GridLinesVisibility="Horizontal"
|
|
HeadersVisibility="Column"
|
|
IsReadOnly="True">
|
|
<DataGrid.Columns>
|
|
<!-- 图标渲染 -->
|
|
<DataGridTemplateColumn Width="60" Header="图标">
|
|
<DataGridTemplateColumn.CellTemplate>
|
|
<DataTemplate>
|
|
<TextBlock
|
|
HorizontalAlignment="Center"
|
|
FontFamily="{Binding Source={x:Reference GridIcons}, Path=DataContext.PreviewFontFamily}"
|
|
FontSize="26"
|
|
Foreground="#333"
|
|
Text="{Binding Character}" />
|
|
</DataTemplate>
|
|
</DataGridTemplateColumn.CellTemplate>
|
|
</DataGridTemplateColumn>
|
|
|
|
<!-- 编码信息 -->
|
|
<DataGridTextColumn
|
|
Width="*"
|
|
Binding="{Binding HexDisplay}"
|
|
FontWeight="SemiBold"
|
|
Header="Unicode (Hex)" />
|
|
|
|
<!-- 变量名预览 -->
|
|
<DataGridTextColumn
|
|
Width="*"
|
|
Binding="{Binding VarName}"
|
|
Foreground="Blue"
|
|
Header="生成变量名" />
|
|
</DataGrid.Columns>
|
|
</DataGrid>
|
|
</GroupBox>
|
|
|
|
<!-- 右侧:代码输出 -->
|
|
<GroupBox
|
|
Grid.Row="1"
|
|
Grid.Column="1"
|
|
Header="生成的 C# 代码">
|
|
<Grid>
|
|
<TextBox
|
|
x:Name="TxtOutput"
|
|
AcceptsReturn="True"
|
|
FontFamily="Consolas"
|
|
FontSize="12"
|
|
HorizontalScrollBarVisibility="Auto"
|
|
TextWrapping="NoWrap"
|
|
VerticalScrollBarVisibility="Auto" />
|
|
<Button
|
|
Margin="0,5,20,0"
|
|
Padding="10,2"
|
|
HorizontalAlignment="Right"
|
|
VerticalAlignment="Top"
|
|
Click="OnCopyCodeClick"
|
|
Content="复制代码" />
|
|
</Grid>
|
|
</GroupBox>
|
|
</Grid>
|
|
</ms:MelWindow>
|