本文整理汇总了C#中Gtk.TextView.OverrideFont方法的典型用法代码示例。如果您正苦于以下问题:C# TextView.OverrideFont方法的具体用法?C# TextView.OverrideFont怎么用?C# TextView.OverrideFont使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.TextView
的用法示例。
在下文中一共展示了TextView.OverrideFont方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateText
private ScrolledWindow CreateText (TextBuffer buffer, bool IsSource)
{
ScrolledWindow scrolledWindow = new ScrolledWindow ();
scrolledWindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
scrolledWindow.ShadowType = ShadowType.In;
TextView textView = new TextView (buffer);
textView.Editable = false;
textView.CursorVisible = false;
scrolledWindow.Add (textView);
if (IsSource) {
FontDescription fontDescription = FontDescription.FromString ("monospace");
textView.OverrideFont (fontDescription);
textView.WrapMode = Gtk.WrapMode.None;
} else {
// Make it a bit nicer for text
textView.WrapMode = Gtk.WrapMode.Word;
textView.PixelsAboveLines = 2;
textView.PixelsBelowLines = 2;
}
return scrolledWindow;
}
示例2: CreateAbout
private void CreateAbout ()
{
Gdk.RGBA white = new Gdk.RGBA ();
white.Parse ("#ffffff");
Gdk.RGBA highlight = new Gdk.RGBA ();
highlight.Parse ("#a8bbcf");
Pango.FontDescription font = StyleContext.GetFont (StateFlags.Normal);
font.Size = 9 * 1024;
CssProvider css_provider = new CssProvider ();
string image_path = new string [] { SparkleUI.AssetsPath, "pixmaps", "about.png" }.Combine ();
css_provider.LoadFromData ("GtkWindow {" +
"background-image: url('" + image_path + "');" +
"background-repeat: no-repeat;" +
"background-position: left bottom;" +
"}");
StyleContext.AddProvider (css_provider, 800);
VBox layout_vertical = new VBox (false, 0);
HBox links_layout = new HBox (false, 16);
Label version = new Label () {
Text = "version " + Controller.RunningVersion,
Xalign = 0, Xpad = 0
};
version.OverrideFont (font);
version.OverrideColor (StateFlags.Normal, white);
this.updates = new Label ("Checking for updates…") {
Xalign = 0, Xpad = 0
};
this.updates.OverrideFont (font);
this.updates.OverrideColor (StateFlags.Normal, highlight);
Label copyright = new Label () {
Markup = string.Format ("Copyright © 2010–{0} Hylke Bons and others.", DateTime.Now.Year),
Xalign = 0, Xpad = 0
};
copyright.OverrideFont (font);
copyright.OverrideColor (StateFlags.Normal, white);
TextView license = new TextView ();
TextBuffer license_buffer = license.Buffer;
license.WrapMode = WrapMode.Word;
license.Sensitive = false;
license_buffer.Text = "SparkleShare is Open Source and you’re free to use, change, " +
"and share it under the GNU GPLv3.";
license.OverrideBackgroundColor (StateFlags.Normal, new Gdk.RGBA () { Alpha = 0 });
license.OverrideFont (font);
license.OverrideColor (StateFlags.Normal, white);
SparkleLink website_link = new SparkleLink ("Website", Controller.WebsiteLinkAddress);
SparkleLink credits_link = new SparkleLink ("Credits", Controller.CreditsLinkAddress);
SparkleLink report_problem_link = new SparkleLink ("Report a problem", Controller.ReportProblemLinkAddress);
SparkleLink debug_log_link = new SparkleLink ("Debug log", Controller.DebugLogLinkAddress);
layout_vertical.PackStart (new Label (""), true, true, 0);
layout_vertical.PackStart (version, false, false, 0);
layout_vertical.PackStart (this.updates, false, false, 0);
layout_vertical.PackStart (copyright, false, false, 6);
layout_vertical.PackStart (license, false, false, 6);
layout_vertical.PackStart (links_layout, false, false, 16);
links_layout.PackStart (website_link, false, false, 0);
links_layout.PackStart (credits_link, false, false, 0);
links_layout.PackStart (report_problem_link, false, false, 0);
links_layout.PackStart (debug_log_link, false, false, 0);
HBox layout_horizontal = new HBox (false, 0);
layout_horizontal.PackStart (new Label (""), false, false, 149);
layout_horizontal.PackStart (layout_vertical, false, false, 0);
Add (layout_horizontal);
}