本文整理汇总了C#中Gtk.Label.OverrideColor方法的典型用法代码示例。如果您正苦于以下问题:C# Label.OverrideColor方法的具体用法?C# Label.OverrideColor怎么用?C# Label.OverrideColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Label
的用法示例。
在下文中一共展示了Label.OverrideColor方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ArtworkPopup
public ArtworkPopup()
: base(Gtk.WindowType.Popup)
{
VBox vbox = new VBox();
Add(vbox);
Decorated = false;
BorderWidth = 6;
SetPosition(WindowPosition.CenterAlways);
image = new Gtk.Image();
label = new Label(String.Empty);
label.CanFocus = false;
label.Wrap = true;
var bg_color = new RGBA ();
bg_color.Red = bg_color.Green = bg_color.Blue = 0;
var fg_color = new RGBA ();
fg_color.Red = bg_color.Green = bg_color.Blue = 160.0 / 255;
label.OverrideBackgroundColor (StateFlags.Normal, bg_color);
label.OverrideColor (StateFlags.Normal, fg_color);
OverrideBackgroundColor (StateFlags.Normal, bg_color);
OverrideColor (StateFlags.Normal, fg_color);
vbox.PackStart(image, true, true, 0);
vbox.PackStart(label, false, false, 0);
vbox.Spacing = 6;
vbox.ShowAll();
}
示例2: CreateLabel
private Label CreateLabel(string value)
{
Label label = new Label ();
label.Xalign = 1.0f;
label.Markup = String.Format ("<small>{0}</small>", GLib.Markup.EscapeText (value));
label.OverrideColor (StateFlags.Normal, Hyena.Gui.GtkUtilities.ColorBlend (
StyleContext.GetColor (StateFlags.Normal), StyleContext.GetBackgroundColor (StateFlags.Normal)));
label.Show ();
return label;
}
示例3: Tile
public Tile()
{
Table table = new Table (2, 2, false);
table.ColumnSpacing = 6;
table.RowSpacing = 2;
table.BorderWidth = 2;
PrimaryLabel = new Label ();
SecondaryLabel = new Label ();
table.Attach (image, 0, 1, 0, 2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
table.Attach (PrimaryLabel, 1, 2, 0, 1,
AttachOptions.Fill | AttachOptions.Expand,
AttachOptions.Shrink, 0, 0);
table.Attach (SecondaryLabel, 1, 2, 1, 2,
AttachOptions.Fill | AttachOptions.Expand,
AttachOptions.Fill | AttachOptions.Expand, 0, 0);
table.ShowAll ();
Add (table);
PrimaryLabel.Xalign = 0.0f;
PrimaryLabel.Yalign = 0.0f;
SecondaryLabel.Xalign = 0.0f;
SecondaryLabel.Yalign = 0.0f;
StyleUpdated += delegate {
PrimaryLabel.OverrideColor (StateFlags.Normal, StyleContext.GetColor (StateFlags.Normal));
Gdk.RGBA rgba = StyleContext.GetColor (StateFlags.Normal);
SecondaryLabel.OverrideColor (StateFlags.Normal, Hyena.Gui.GtkUtilities.ColorBlend (
rgba, StyleContext.GetBackgroundColor (StateFlags.Normal)));
};
Relief = ReliefStyle.None;
}
示例4: UpdateForArtist
private void UpdateForArtist(string artist_name, LastfmData<SimilarArtist> similar_artists,
LastfmData<ArtistTopAlbum> top_albums, LastfmData<ArtistTopTrack> top_tracks)
{
ThreadAssist.ProxyToMain (delegate {
album_box.Title = String.Format (album_title_format, artist);
track_box.Title = String.Format (track_title_format, artist);
similar_artists_view.ClearWidgets ();
ClearBox (album_list);
ClearBox (track_list);
// Similar Artists
var artists = similar_artists.Take (20);
if (artists.Count () > 0) {
int artist_name_max_len = 2 * (int) artists.Select (a => a.Name.Length).Average ();
foreach (var similar_artist in artists) {
SimilarArtistTile tile = new SimilarArtistTile (similar_artist);
tile.PrimaryLabel.WidthChars = artist_name_max_len;
tile.PrimaryLabel.Ellipsize = Pango.EllipsizeMode.End;
tile.ShowAll ();
similar_artists_view.AddWidget (tile);
}
no_artists_pane.Hide ();
similar_artists_view_sw.ShowAll ();
} else {
similar_artists_view_sw.Hide ();
no_artists_pane.ShowAll ();
}
for (int i = 0; i < Math.Min (5, top_albums.Count); i++) {
ArtistTopAlbum album = top_albums[i];
Button album_button = new Button ();
album_button.Relief = ReliefStyle.None;
Label label = new Label ();
label.OverrideColor (StateFlags.Normal, StyleContext.GetColor (StateFlags.Normal));
label.Ellipsize = Pango.EllipsizeMode.End;
label.Xalign = 0;
label.Markup = String.Format ("{0}. {1}", i+1, GLib.Markup.EscapeText (album.Name));
album_button.Add (label);
album_button.Clicked += delegate {
Banshee.Web.Browser.Open (album.Url);
};
album_list.PackStart (album_button, false, true, 0);
}
album_box.ShowAll ();
for (int i = 0; i < Math.Min (5, top_tracks.Count); i++) {
ArtistTopTrack track = top_tracks[i];
Button track_button = new Button ();
track_button.Relief = ReliefStyle.None;
HBox box = new HBox ();
Label label = new Label ();
label.OverrideColor (StateFlags.Normal, StyleContext.GetColor (StateFlags.Normal));
label.Ellipsize = Pango.EllipsizeMode.End;
label.Xalign = 0;
label.Markup = String.Format ("{0}. {1}", i+1, GLib.Markup.EscapeText (track.Name));
/*if(node.SelectSingleNode("track_id") != null) {
box.PackEnd(new Image(now_playing_arrow), false, false, 0);
track_button.Clicked += delegate {
//PlayerEngineCore.OpenPlay(Globals.Library.GetTrack(
//Convert.ToInt32(node.SelectSingleNode("track_id").InnerText)));
};
} else {*/
track_button.Clicked += delegate {
Banshee.Web.Browser.Open (track.Url);
};
//}
box.PackStart (label, true, true, 0);
track_button.Add (box);
track_list.PackStart (track_button, false, true, 0);
}
track_box.ShowAll ();
ready = true;
refreshing = false;
context_page.SetState (Banshee.ContextPane.ContextState.Loaded);
});
}
示例5: 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);
}