在App.xaml中,我有以下代码:
<Application.Resources>
<Style x:Key="LabelTemplate" TargetType="{x:Type Label}">
<Setter Property="Height" Value="53" />
<Setter Property="Width" Value="130" />
<Setter Property="HorizontalAlignment" Value="Left" />
<Setter Property="Margin" Value="99,71,0,0" />
<Setter Property="VerticalAlignment" Value= "Top" />
<Setter Property="Foreground" Value="#FFE75959" />
<Setter Property="FontFamily" Value="Calibri" />
<Setter Property="FontSize" Value="40" />
</Style>
</Application.Resources>
Run Code Online (Sandbox Code Playgroud)
这是为了为我的标签提供通用模板.
在主要的XAML代码中,我有以下代码行:
<Label Content="Movies" Style="{StaticResource LabelTemplate}" Name="label1" />
Run Code Online (Sandbox Code Playgroud)
但是,我想通过代码初始化Style属性.我试过了:
label1.Style = new Style("{StaticResource LabelTemplate}");
Run Code Online (Sandbox Code Playgroud)
和
label1.Style = "{StaticResource LabelTemplate}";
Run Code Online (Sandbox Code Playgroud)
两种解决方案都无效.
任何帮助,将不胜感激 :).
我已经尝试了一切但似乎无法将这个文本集中在一起.有人可以告诉我错误在哪里.
NSMutableParagraphStyle *paragraphStyle = NSMutableParagraphStyle.new;
paragraphStyle.alignment = NSTextAlignmentCenter;
label.attributedText = [[NSAttributedString alloc] initWithString:cell.EventTitle.text attributes:@{NSForegroundColorAttributeName : [UIColor whiteColor],NSParagraphStyleAttributeName:paragraphStyle,NSBaselineOffsetAttributeName : @0,NSFontAttributeName : [UIFont fontWithName:@"BrandonGrotesque-Black" size:34]}];
Run Code Online (Sandbox Code Playgroud) 如何更改yaxis标签的大小?现在,我使用更改所有标签的大小
pylab.rc('font', family='serif', size=40)
Run Code Online (Sandbox Code Playgroud)
但在我的情况下,我想使y轴标签大于x轴.但是,我想单独留下刻度标签.
我试过,例如:
pylab.gca().get_ylabel().set_fontsize(60)
Run Code Online (Sandbox Code Playgroud)
但我只得到:
AttributeError: 'str' object has no attribute 'set_fontsize'
Run Code Online (Sandbox Code Playgroud)
所以,显然这不起作用.我已经看到很多用于刻度尺寸的东西,但轴标签本身没有.
是否有解决下面代码中说明的问题的方法?首先在浏览器中打开代码直接到达关键点,而不必在知道您要查找的内容之前查看所有代码.
<html>
<head>
<title>Input ID creates problems</title>
<style type="text/css">
#prologue, #summary { margin: 5em; }
</style>
</head>
<body>
<h1>Input ID creates a bug</h1>
<p id="prologue">
In this example, I make a list of checkboxes representing things which could appear in a book. If you want some in your book, you check them:
</p>
<form>
<ul>
<li>
<input type="checkbox" id="prologue" />
<label for="prologue">prologue</label>
</li>
<li>
<input type="checkbox" id="chapter" />
<label for="chapter">chapter</label>
</li>
<li>
<input type="checkbox" id="summary" />
<label for="summary">summary</label>
</li>
<li> …Run Code Online (Sandbox Code Playgroud) 在我的C#表单中,我有一个标签,在下载事件中显示下载百分比:
this.lblprg.Text = overallpercent.ToString("#0") + "%";
Run Code Online (Sandbox Code Playgroud)
Label控件的BackColor属性设置为透明,我希望它显示在PictureBox上.但这似乎不能正常工作,我看到一个灰色的背景,它在图片框的顶部看起来不透明.我怎样才能解决这个问题?
我的表格上有一个标签,位于表格的右侧.此标签加载动态文本.
有时它加载的文本太长,文本越过表单的边框,这是一些文本不在表单中.
我想让标签从右到左而不是从左到右.我该如何实现这一目标?
我有一个显示元素:inline-block,但它似乎不接受margin-top.这是因为元素仍被视为内联元素吗?
如果是,有没有人有解决方法?
编辑#1:
我的CSS非常简单:
.label {
background: #ffffff;
display: inline-block;
margin-top: -2px;
padding: 7px 7px 5px;
}
Run Code Online (Sandbox Code Playgroud)
我最终将内容包装在另一个div中并给出了一个优势.但这会导致大量额外的标记,并使我的代码不那么清晰.
编辑#2:
margin-top&margin-bottomon inline-block元素似乎只与正值一起使用.
如何设置标签文本的颜色?
myLabel.setText("Text Color: Red");
myLabel.???
Run Code Online (Sandbox Code Playgroud)
我可以在一个标签中使用两种单独的颜色吗?
例如这里:
该"Text Color:"是黑色,"Red"是红色的.
我试图在网格图中绘制计数,但我无法弄清楚我是如何去做的.我想要:
以5为间隔有网格
每20个主要的刻度标签
我希望刻度线在情节之外.
在这些网格中"有计数"
这是我的代码.
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator, FormatStrFormatter
for key, value in sorted(data.items()):
x = value[0][2]
y = value[0][3]
count = value[0][4]
fig = plt.figure()
ax = fig.add_subplot(111)
ax.annotate(count, xy = (x, y), size = 5)
# Overwrites and I only get the last data point
plt.close()
# Without this, I get "fail to allocate bitmap" error
plt.suptitle('Number of counts', fontsize = 12)
ax.set_xlabel('x')
ax.set_ylabel('y')
plt.axes().set_aspect('equal')
plt.axis([0, 1000, …Run Code Online (Sandbox Code Playgroud)