本文整理汇总了C#中Gtk.Label.ModifyFont方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.Label.ModifyFont方法的具体用法?C# Gtk.Label.ModifyFont怎么用?C# Gtk.Label.ModifyFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Label
的用法示例。
在下文中一共展示了Gtk.Label.ModifyFont方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WelcomePageTipOfTheDaySection
public WelcomePageTipOfTheDaySection (): base (GettextCatalog.GetString ("Did you know?"))
{
XmlDocument xmlDocument = new XmlDocument ();
xmlDocument.Load (System.IO.Path.Combine (System.IO.Path.Combine (PropertyService.DataPath, "options"), "TipsOfTheDay.xml"));
foreach (XmlNode xmlNode in xmlDocument.DocumentElement.ChildNodes) {
tips.Add (StringParserService.Parse (xmlNode.InnerText));
}
if (tips.Count != 0)
currentTip = new Random ().Next () % tips.Count;
else
currentTip = -1;
Gtk.VBox box = new Gtk.VBox (false, 12);
label = new Gtk.Label ();
label.Xalign = 0;
label.Wrap = true;
label.WidthRequest = 200;
label.ModifyFont (FontService.SansFont.CopyModified (Gui.Styles.FontScale11));
label.SetPadding (0, 10);
label.Text = currentTip != -1 ? tips[currentTip] : "";
box.PackStart (label, true, true, 0);
var next = new Gtk.Button (GettextCatalog.GetString ("Next Tip"));
next.Relief = Gtk.ReliefStyle.Normal;
next.Clicked += delegate {
if (tips.Count == 0)
return;
currentTip = currentTip + 1;
if (currentTip >= tips.Count)
currentTip = 0;
label.Text = tips[currentTip];
};
var al = new Gtk.Alignment (0, 0, 0, 0);
al.Add (next);
box.PackStart (al, false, false, 0);
SetContent (box);
}
示例2: CreateLabel
static Gtk.Label CreateLabel(string text){
var label = new Gtk.Label (text);
label.ModifyFont (new Pango.FontDescription { Weight = Pango.Weight.Bold });
return label;
}
示例3: AddLabel
void AddLabel ()
{
if (label == null) {
alignment = new Gtk.Alignment (0.5f, 0.5f, 1f, 1f);
alignment.SetPadding (4, 5, 4, 4);
label = new Gtk.Label ();
label.ModifyFont (Theme.Font);
alignment.Add (label);
ContentBox.Add (alignment);
alignment.ShowAll ();
}
}