create image from character

心不动则不痛 提交于 2020-01-06 20:01:28

问题


I'm using standard styles for my Metro app. Most of these styles contains an Image and I wanna use Segoe UI Symbols as these images.

how can I achieve this?


回答1:


You can insert the "character" in any text content that is using the Segoe UI Symbol as the font. If I wanted a Favorite's Star in a TextBlock, it would look like this...

<TextBox x:Name="textBox" HorizontalAlignment="Left" Margin="372,375,0,0" TextWrapping="Wrap" Text="&#xE113;" VerticalAlignment="Top" FontFamily="Segoe UI Symbol"/>

If I wanted to make a button that had the same "character" in it, I would do this...

<Button x:Name="button" Content="&#xE113;" HorizontalAlignment="Left" Margin="372,181,0,0" VerticalAlignment="Top" Click="button_Click" FontFamily="Segoe UI Symbol" FontSize="24"  Height="79" Width="128"/>

If I wanted the button to take on the circle AppBar button style, I would add the Style resource like this...

<Button x:Name="button" Content="&#xE113;" HorizontalAlignment="Left" Margin="372,181,0,0" VerticalAlignment="Top" Click="button_Click" FontFamily="Segoe UI Symbol" FontSize="24" Style="{StaticResource AppBarButtonStyle}" Height="79" Width="128"/>

Same type of approach if you are using HTML. Just make sure you styles are correct...

<span class="pagetitle">&#xE113;</span>


来源:https://stackoverflow.com/questions/12037888/create-image-from-character

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!