我有问题,我不知道在哪里问。 我有一些标签,label1 =“TheKernelProject”和带有“■”的7个标签,我看到它是这样的:
Sorry for the links to the images, I haven´t got 10 of reputation
我不知道如何改变它。我没碰到任何东西。无论如何,谢谢。
编辑: (内部<Window>
)
<Grid x:Name="loaderGrid" RenderTransformOrigin="0.523,0.634">
<Label x:Name="label1" Content="TheKernelProject" HorizontalAlignment="Center" Margin="637,408,484,289" VerticalAlignment="Center" FontSize="22" Foreground="Blue"/>
<Label x:Name="sq1" Content="■" HorizontalAlignment="Left" Margin="641,460,0,0" VerticalAlignment="Top" Width="20" Background="#00000000" Foreground="#FF00FFD1" Height="22"/>
<Label x:Name="sq2" Content="■" HorizontalAlignment="Left" Margin="666,460,0,254" VerticalAlignment="Center" Width="20" RenderTransformOrigin="3.713,2.14" Foreground="#FF28CD28" Height="22"/>
<Label x:Name="sq3" Content="■" HorizontalAlignment="Center" Margin="691,460,584,0" VerticalAlignment="Top" Width="20" RenderTransformOrigin="11.358,9.457" Foreground="#FFE4830F" Height="22"/>
<Label x:Name="sq4" Content="■" HorizontalAlignment="Left" Margin="716,460,0,254" Width="20" VerticalAlignment="Center" RenderTransformOrigin="10.509,-2.038" Foreground="Red" Height="22"/>
<Label x:Name="sq5" Content="■" HorizontalAlignment="Left" Margin="741,460,0,254" VerticalAlignment="Center" Width="20" RenderTransformOrigin="7.564,-2.996" Foreground="#FF00FFD1" Height="22"/>
<Label x:Name="sq6" Content="■" HorizontalAlignment="Left" Margin="766,460,0,254" VerticalAlignment="Center" Width="20" RenderTransformOrigin="9.546,-1.82" Foreground="#FF28CD28" Height="22"/>
<Label x:Name="sq7" Content="■" HorizontalAlignment="Center" Margin="791,460,484,0" VerticalAlignment="Top" Width="20" RenderTransformOrigin="0.492,0.528" Foreground="#FFE4830F" Height="22"/>
</Grid>
我只想制作一种带ASCII的加载器,标签的.Visibility。 (它对我很好)
答案 0 :(得分:2)
<Label HorizontalAlignment="Stretch" VerticalAlignment="Top">
<Label.Content>
<Grid Margin="5,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<TextBlock x:Name="lblTitle" Text="TheKernelProject" Grid.Column="0" Grid.ColumnSpan="8" Foreground="Blue" FontSize="20" Margin="2"/>
<TextBlock x:Name="sq1" Text="■" Grid.Column="0" Grid.Row="1" Foreground="#FF00FFD1" Margin="2"/>
<TextBlock x:Name="sq2" Text="■" Grid.Column="1" Grid.Row="1" Foreground="#FF28CD28" Margin="2"/>
<TextBlock x:Name="sq3" Text="■" Grid.Column="2" Grid.Row="1" Foreground="#FFE4830F" Margin="2"/>
<TextBlock x:Name="sq4" Text="■" Grid.Column="3" Grid.Row="1" Foreground="Red" Margin="2"/>
<TextBlock x:Name="sq5" Text="■" Grid.Column="4" Grid.Row="1" Foreground="#FF00FFD1" Margin="2"/>
<TextBlock x:Name="sq6" Text="■" Grid.Column="5" Grid.Row="1" Foreground="#FF28CD28" Margin="2"/>
<TextBlock x:Name="sq7" Text="■" Grid.Column="6" Grid.Row="1" Foreground="#FFE4830F" Margin="2"/>
</Grid>
</Label.Content>
</Label>
使用Label.Content。
答案 1 :(得分:0)
在我看来只是一个保证金问题。尝试减少它..
答案 2 :(得分:0)
边距过高导致那些裁剪控件。您可以使用这样的网格控件来避免这些硬编码值并让它为您标记对齐:
<StackPanel HorizontalAlignment="Center">
<Label x:Name="label1" Content="TheKernelProject" HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="22" Foreground="Blue"/>
<Grid Margin="5,10,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Label x:Name="sq1" Content="■" Grid.Column="0" Foreground="#FF00FFD1"/>
<Label x:Name="sq2" Content="■" Grid.Column="1" Foreground="#FF28CD28"/>
<Label x:Name="sq3" Content="■" Grid.Column="2" Foreground="#FFE4830F"/>
<Label x:Name="sq4" Content="■" Grid.Column="3" Foreground="Red"/>
<Label x:Name="sq5" Content="■" Grid.Column="4" Foreground="#FF00FFD1"/>
<Label x:Name="sq6" Content="■" Grid.Column="5" Foreground="#FF28CD28"/>
<Label x:Name="sq7" Content="■" Grid.Column="6" Foreground="#FFE4830F"/>
</Grid>
</StackPanel>
Grid控件中剩下的唯一边距定义:
随意调整这些值以满足您的需求。