本文整理汇总了C#中Gtk.Label.ModifyBg方法的典型用法代码示例。如果您正苦于以下问题:C# Label.ModifyBg方法的具体用法?C# Label.ModifyBg怎么用?C# Label.ModifyBg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Label
的用法示例。
在下文中一共展示了Label.ModifyBg方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TitledList
public TitledList(string title_str)
: base()
{
genre_map = new Dictionary<string, Genre> ();
title = new Label ();
title.Xalign = 0;
title.Ellipsize = Pango.EllipsizeMode.End;
title.Markup = String.Format ("<b>{0}</b>", GLib.Markup.EscapeText (title_str));
PackStart (title, false, false, 0);
title.Show ();
StyleSet += delegate {
title.ModifyBg (StateType.Normal, Style.Base (StateType.Normal));
title.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
};
tile_view = new TileView (2);
PackStart (tile_view, true, true, 0);
tile_view.Show ();
StyleSet += delegate {
tile_view.ModifyBg (StateType.Normal, Style.Base (StateType.Normal));
tile_view.ModifyFg (StateType.Normal, Style.Base (StateType.Normal));
};
}
示例2: 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;
label.ModifyBg(StateType.Normal, new Color(0, 0, 0));
label.ModifyFg(StateType.Normal, new Color(160, 160, 160));
ModifyBg(StateType.Normal, new Color(0, 0, 0));
ModifyFg(StateType.Normal, new Color(160, 160, 160));
vbox.PackStart(image, true, true, 0);
vbox.PackStart(label, false, false, 0);
vbox.Spacing = 6;
vbox.ShowAll();
}
示例3: TitledList
public TitledList (string title_str) : base (false, 3)
{
title = new Label ();
title.Xalign = 0;
title.Wrap = true;
title.Layout.Wrap = Pango.WrapMode.Word;
title.Ellipsize = Pango.EllipsizeMode.None;
Title = title_str;
PackStart (title, false, false, 0);
title.Show ();
StyleSet += delegate {
title.ModifyBg (StateType.Normal, Style.Base (StateType.Normal));
title.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
};
}
示例4: GtkErrorDialog
public GtkErrorDialog (Window parent, string title, string message, AlertButton[] buttons)
{
if (string.IsNullOrEmpty (title))
throw new ArgumentException ();
if (buttons == null)
throw new ArgumentException ();
Title = BrandingService.ApplicationName;
TransientFor = parent;
Modal = true;
WindowPosition = Gtk.WindowPosition.CenterOnParent;
DefaultWidth = 624;
DefaultHeight = 142;
this.VBox.BorderWidth = 2;
var hbox = new HBox () {
Spacing = 6,
BorderWidth = 12,
};
var errorImage = new Image (Gtk.Stock.DialogError, IconSize.Dialog) {
Yalign = 0F,
};
hbox.PackStart (errorImage, false, false, 0);
this.VBox.Add (hbox);
var vbox = new VBox () {
Spacing = 6,
};
hbox.PackEnd (vbox, true, true, 0);
var titleLabel = new Label () {
Markup = "<b>" + GLib.Markup.EscapeText (title) + "</b>",
Xalign = 0F,
};
vbox.PackStart (titleLabel, false, false, 0);
if (!string.IsNullOrWhiteSpace (message)) {
message = message.Trim ();
var descriptionLabel = new Label (message) {
Xalign = 0F,
Selectable = true,
};
descriptionLabel.LineWrap = true;
descriptionLabel.WidthRequest = 500;
descriptionLabel.ModifyBg (StateType.Normal, new Gdk.Color (255,0,0));
vbox.PackStart (descriptionLabel, false, false, 0);
}
expander = new Expander (GettextCatalog.GetString ("Details")) {
CanFocus = true,
Visible = false,
};
vbox.PackEnd (expander, true, true, 0);
var sw = new ScrolledWindow () {
HeightRequest = 180,
ShadowType = ShadowType.Out,
};
expander.Add (sw);
detailsTextView = new TextView () {
CanFocus = true,
};
detailsTextView.KeyPressEvent += TextViewKeyPressed;
sw.Add (detailsTextView);
var aa = this.ActionArea;
aa.Spacing = 10;
aa.LayoutStyle = ButtonBoxStyle.End;
aa.BorderWidth = 5;
aa.Homogeneous = true;
expander.Activated += delegate {
this.AllowGrow = expander.Expanded;
GLib.Timeout.Add (100, delegate {
Resize (DefaultWidth, 1);
return false;
});
};
tagNoWrap = new TextTag ("nowrap");
tagNoWrap.WrapMode = WrapMode.None;
detailsTextView.Buffer.TagTable.Add (tagNoWrap);
tagWrap = new TextTag ("wrap");
tagWrap.WrapMode = WrapMode.Word;
detailsTextView.Buffer.TagTable.Add (tagWrap);
this.Buttons = buttons;
for (int i = 0; i < Buttons.Length; i++) {
Gtk.Button button;
button = new Gtk.Button (Buttons[i].Label);
button.ShowAll ();
AddActionWidget (button, i);
}
Child.ShowAll ();
Hide ();
//.........这里部分代码省略.........
示例5: CreateViewWidget
private Widget CreateViewWidget()
{
HBox hbox = new HBox (false, 2);
statusLabel = new Label ();
statusLabel.ModifyBg (StateType.Normal, Style.Background (StateType.Active));
statusLabel.LineWrap = false;
statusLabel.UseMarkup = true;
statusLabel.UseUnderline = false;
statusLabel.Show ();
hbox.PackStart (statusLabel, true, true, 0);
Image downImage = new Image (Stock.GoDown, IconSize.Menu);
statusDownButton = new Button (downImage);
statusDownButton.ModifyBg (StateType.Normal, Style.Background (StateType.Active));
statusDownButton.Relief = ReliefStyle.None;
statusDownButton.Clicked += OnStatusDownButtonClicked;
statusDownButton.Show ();
hbox.PackStart (statusDownButton, false, false, 0);
hbox.Show ();
return hbox;
}