本文整理汇总了C#中Gtk.Label.ModifyFg方法的典型用法代码示例。如果您正苦于以下问题:C# Label.ModifyFg方法的具体用法?C# Label.ModifyFg怎么用?C# Label.ModifyFg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Label
的用法示例。
在下文中一共展示了Label.ModifyFg方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetVisualizerWidget
public override Control GetVisualizerWidget (ObjectValue val)
{
string value = val.Value;
Gdk.Color col = new Gdk.Color (85, 85, 85);
if (!val.IsNull && (val.TypeName == "string" || val.TypeName == "char[]"))
value = '"' + GetString (val) + '"';
if (DebuggingService.HasInlineVisualizer (val))
value = DebuggingService.GetInlineVisualizer (val).InlineVisualize (val);
var label = new Gtk.Label ();
label.Text = value;
var font = label.Style.FontDescription.Copy ();
if (font.SizeIsAbsolute) {
font.AbsoluteSize = font.Size - 1;
} else {
font.Size -= (int)(Pango.Scale.PangoScale);
}
label.ModifyFont (font);
label.ModifyFg (StateType.Normal, col);
label.SetPadding (4, 4);
if (label.SizeRequest ().Width > 500) {
label.WidthRequest = 500;
label.Wrap = true;
label.LineWrapMode = Pango.WrapMode.WordChar;
} else {
label.Justify = Gtk.Justification.Center;
}
if (label.Layout.GetLine (1) != null) {
label.Justify = Gtk.Justification.Left;
var line15 = label.Layout.GetLine (15);
if (line15 != null) {
label.Text = value.Substring (0, line15.StartIndex).TrimEnd ('\r', '\n') + "\n…";
}
}
label.Show ();
return label;
}
示例2: SparkleLink
public SparkleLink(string title, string url)
: base()
{
Label label = new Label () {
Ellipsize = Pango.EllipsizeMode.Middle,
UseMarkup = true,
Markup = title,
Xalign = 0
};
Add (label);
Gdk.Color color = new Gdk.Color ();
// Only make links for files that exist
if (!url.StartsWith ("http://") && !File.Exists (url)) {
// Use Tango Aluminium for the links
Gdk.Color.Parse ("#2e3436", ref color);
label.ModifyFg (StateType.Normal, color);
return;
}
// Use Tango Sky Blue for the links
Gdk.Color.Parse ("#3465a4", ref color);
label.ModifyFg (StateType.Normal, color);
// Open the URL when it is clicked
ButtonReleaseEvent += delegate {
Process process = new Process ();
process.StartInfo.FileName = "gnome-open";
process.StartInfo.Arguments = url.Replace (" ", "\\ "); // Escape space-characters
process.Start ();
};
// Add underline when hovering the link with the cursor
EnterNotifyEvent += delegate {
label.Markup = "<u>" + title + "</u>";
ShowAll ();
Realize ();
GdkWindow.Cursor = new Gdk.Cursor (Gdk.CursorType.Hand2);
};
// Remove underline when leaving the link with the cursor
LeaveNotifyEvent += delegate {
label.Markup = title;
ShowAll ();
Realize ();
GdkWindow.Cursor = new Gdk.Cursor (Gdk.CursorType.Arrow);
};
}
示例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;
StyleSet += delegate {
PrimaryLabel.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
SecondaryLabel.ModifyFg (StateType.Normal, Hyena.Gui.GtkUtilities.ColorBlend (
Style.Foreground (StateType.Normal), Style.Background (StateType.Normal)));
};
Relief = ReliefStyle.None;
}
示例4: 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();
}
示例5: 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));
};
}
示例6: Category
public Category (Tiles.TileGroupInfo info, int columns)
{
WidgetFlags |= WidgetFlags.NoWindow;
header = new Gtk.HBox (false, 0);
headerExpander = new Gtk.Expander ("<big><b>" + GLib.Markup.EscapeText (info.Name) + "</b></big>");
((Gtk.Label) headerExpander.LabelWidget).SetAlignment (0.0f, 0.5f);
headerExpander.UseMarkup = true;
headerExpander.UseUnderline = true;
headerExpander.Show ();
header.PackStart (headerExpander, true, true, 0);
headerExpander.Activated += OnActivated;
scope = Tiles.Utils.TileGroupToScopeType(info.Group);
position = new Gtk.Label ();
position.ModifyFg (Gtk.StateType.Normal, position.Style.Base (Gtk.StateType.Selected));
header.PackStart (position, false, false, 0);
position.Show ();
prev = MakeButton (header, Gtk.Stock.GoBack, OnPrev);
next = MakeButton (header, Gtk.Stock.GoForward, OnNext);
header.Show ();
header.Parent = this;
header.SizeRequested += HeaderSizeRequested;
tiles = new SortedTileList (Beagle.Search.SortType.Relevance);
Columns = columns;
UpdateButtons ();
Expanded = true;
}
示例7: 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.ModifyFg (StateType.Normal, Hyena.Gui.GtkUtilities.ColorBlend (
Style.Foreground (StateType.Normal), Style.Background (StateType.Normal)));
label.Show ();
return label;
}
示例8: LinkLabel
public LinkLabel(string text, Uri uri)
{
CanFocus = true;
AppPaintable = true;
this.uri = uri;
label = new Label(text);
label.ModifyFg(Gtk.StateType.Normal, link_color);
label.Show();
Add(label);
}
示例9: 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));
};
}
示例10: Append
public void Append (string tip)
{
uint row = table.NRows;
Gtk.Image image = new Gtk.Image (arrow);
image.Show ();
table.Attach (image, 0, 1, row, row + 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);
Gtk.Label label = new Gtk.Label ();
label.Markup = tip;
label.LineWrap = true;
label.Justify = Justification.Fill;
label.SetAlignment (0.0f, 0.5f);
label.ModifyFg (Gtk.StateType.Normal, label.Style.Foreground (Gtk.StateType.Insensitive));
label.Show ();
table.Attach (label, 1, 2, row, row + 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0, 0);
}
示例11: GetVisualizerWidget
public override Control GetVisualizerWidget (ObjectValue val)
{
var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
ops.AllowTargetInvoke = true;
ops.ChunkRawStrings = true;
ops.EllipsizedLength = 5000;//Preview window can hold aprox. 4700 chars
val.Refresh (ops);//Refresh DebuggerDisplay/String value with full length instead of ellipsized
string value = val.Value;
Gdk.Color col = Styles.PreviewVisualizerTextColor.ToGdkColor ();
if (DebuggingService.HasInlineVisualizer (val))
value = DebuggingService.GetInlineVisualizer (val).InlineVisualize (val);
var label = new Gtk.Label ();
label.Text = value;
label.ModifyFont (FontService.SansFont.CopyModified (Ide.Gui.Styles.FontScale11));
label.ModifyFg (StateType.Normal, col);
label.SetPadding (4, 4);
if (label.SizeRequest ().Width > 500) {
label.WidthRequest = 500;
label.Wrap = true;
label.LineWrapMode = Pango.WrapMode.WordChar;
} else {
label.Justify = Gtk.Justification.Center;
}
if (label.Layout.GetLine (1) != null) {
label.Justify = Gtk.Justification.Left;
var trimmedLine = label.Layout.GetLine (50);
if (trimmedLine != null) {
label.Text = value.Substring (0, trimmedLine.StartIndex).TrimEnd ('\r', '\n') + "\n…";
}
}
label.Show ();
return label;
}
示例12: GetVisualizerWidget
public override Control GetVisualizerWidget (ObjectValue val)
{
string value = val.Value;
Gdk.Color col = Styles.PreviewVisualizerTextColor.ToGdkColor ();
if (!val.IsNull && (val.TypeName == "string" || val.TypeName == "char[]"))
value = '"' + GetString (val) + '"';
if (DebuggingService.HasInlineVisualizer (val))
value = DebuggingService.GetInlineVisualizer (val).InlineVisualize (val);
var label = new Gtk.Label ();
label.Text = value;
label.ModifyFont (FontService.SansFont.CopyModified (Ide.Gui.Styles.FontScale11));
label.ModifyFg (StateType.Normal, col);
label.SetPadding (4, 4);
if (label.SizeRequest ().Width > 500) {
label.WidthRequest = 500;
label.Wrap = true;
label.LineWrapMode = Pango.WrapMode.WordChar;
} else {
label.Justify = Gtk.Justification.Center;
}
if (label.Layout.GetLine (1) != null) {
label.Justify = Gtk.Justification.Left;
var line15 = label.Layout.GetLine (15);
if (line15 != null) {
label.Text = value.Substring (0, line15.StartIndex).TrimEnd ('\r', '\n') + "\n…";
}
}
label.Show ();
return label;
}
示例13: iFolderInfoBox
private Widget iFolderInfoBox()
{
VBox iFolderInfo = new VBox(false, 0);
string lable = null;
lable = Util.GS("N/A");
lable = string.Format(Util.GS("Name: {0}"),lable);
labelName = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
iFolderInfo.PackStart(labelName, false, false, 0);
labelName.UseMarkup = true;
labelName.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
labelName.Xalign = 0.0F;
lable = Util.GS("N/A");
lable = string.Format(Util.GS("Access: {0}"),lable);
labelAccess = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
iFolderInfo.PackStart(labelAccess, false, false, 0);
labelAccess.UseMarkup = true;
labelAccess.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
labelAccess.Xalign = 0.0F;
lable = Util.GS("N/A");
lable = string.Format(Util.GS("Owner: {0}"),lable);
labelOwner = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
iFolderInfo.PackStart(labelOwner, false, false, 0);
labelOwner.UseMarkup = true;
labelOwner.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
labelOwner.Xalign = 0.0F;
return iFolderInfo;
}
示例14: CreateiFolderActionButtonArea
//.........这里部分代码省略.........
new EventHandler(OnResolveConflicts);
buttontips.SetTip(ResolveConflictsButton, Util.GS("Resolve conflicts"),"");
SynchronizedFolderTasks = new VBox(false, 0);
ButtonControl.PackStart(SynchronizedFolderTasks, false, false, 0);
spacerHBox = new HBox(false, 0);
SynchronizedFolderTasks.PackStart(spacerHBox, false, false, 0);
hbox = new HBox(false, 0);
OpenSynchronizedFolderButton = new Button(hbox);
vbox.PackStart(OpenSynchronizedFolderButton, false, false, 0);
buttonText = new Label(
string.Format("<span>{0}</span>",
Util.GS("Open...")));
hbox.PackStart(buttonText, false, false, 4);
buttonText.UseMarkup = true;
buttonText.UseUnderline = false;
buttonText.Xalign = 0;
OpenSynchronizedFolderButton.Visible = false;
OpenSynchronizedFolderButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder48.png")));
OpenSynchronizedFolderButton.Clicked +=
new EventHandler(OnOpenSynchronizedFolder);
buttontips.SetTip(OpenSynchronizedFolderButton, Util.GS("Open iFolder"),"");
hbox = new HBox(false, 0);
SynchronizeNowButton = new Button(hbox);
vbox.PackStart(SynchronizeNowButton, false, false, 0);
buttonText = new Label(
string.Format("<span>{0}</span>",
Util.GS("Synchronize Now")));
hbox.PackStart(buttonText, true, true, 4);
buttonText.UseMarkup = true;
buttonText.UseUnderline = false;
buttonText.Xalign = 0;
SynchronizeNowButton.Sensitive = false;
SynchronizeNowButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder-sync48.png")));
SynchronizeNowButton.Clicked +=
new EventHandler(OnSynchronizeNow);
buttontips.SetTip(SynchronizeNowButton, Util.GS("Synchronize Now"),"");
hbox = new HBox(false, 0);
RemoveiFolderButton = new Button(hbox);
vbox.PackStart(RemoveiFolderButton, false, false, 0);
buttonText = new Label(
string.Format("<span>{0}</span>",
Util.GS("Revert to a Normal Folder")));
hbox.PackStart(buttonText, true, true, 4);
buttonText.UseMarkup = true;
buttonText.UseUnderline = false;
buttonText.Xalign = 0;
RemoveiFolderButton.Sensitive = false;
RemoveiFolderButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("revert48.png")));
RemoveiFolderButton.Clicked +=
new EventHandler(RemoveiFolderHandler);
buttontips.SetTip(RemoveiFolderButton, Util.GS("Revert to a Normal Folder"),"");
hbox = new HBox(false, 0);
ViewFolderPropertiesButton = new Button(hbox);
vbox.PackStart(ViewFolderPropertiesButton, false, false, 0);
buttonText = new Label(
string.Format("<span>{0}</span>",
Util.GS("Properties...")));
hbox.PackStart(buttonText, true, true, 4);
buttonText.UseMarkup = true;
buttonText.UseUnderline = false;
buttonText.Xalign = 0;
ViewFolderPropertiesButton.Visible = false;
ViewFolderPropertiesButton.Image = new Image(new Gdk.Pixbuf(Util.ImagesPath("ifolder48.png")));
ViewFolderPropertiesButton.Clicked +=
new EventHandler(OnShowFolderProperties);
buttontips.SetTip(ViewFolderPropertiesButton, Util.GS("Properties"),"");
ButtonControl.PackStart(new Label(""), false, false, 4);
HBox searchHBox = new HBox(false, 4);
searchHBox.WidthRequest = 110;
ButtonControl.PackEnd(searchHBox, false, false, 0);
SearchEntry = new Entry();
searchHBox.PackStart(SearchEntry, true, true, 0);
SearchEntry.SelectRegion(0, -1);
SearchEntry.CanFocus = true;
SearchEntry.Changed +=
new EventHandler(OnSearchEntryChanged);
Label l = new Label("<span size=\"small\"></span>");
l = new Label(
string.Format(
"<span size=\"large\">{0}</span>",
Util.GS("Filter")));
ButtonControl.PackEnd(l, false, false, 0);
l.UseMarkup = true;
l.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
l.Xalign = 0.0F;
VBox viewChanger = new VBox(false,0);
string[] list = {Util.GS("Open Panel"),Util.GS("Close Panel"),Util.GS("Thumbnail View"),Util.GS("List View") };
viewList = new ComboBoxEntry (list);
viewList.Active = 0;
viewList.WidthRequest = 110;
viewList.Changed += new EventHandler(OnviewListIndexChange);
VBox dummyVbox = new VBox(false,0);
Label labeldummy = new Label( string.Format( ""));
labeldummy.UseMarkup = true;
dummyVbox.PackStart(labeldummy,false,true,0);
viewChanger.PackStart(dummyVbox,false,true,0);
viewChanger.PackStart(viewList,false,true,0);
ButtonControl.PackEnd(viewChanger, false, true,0);
return buttonArea;
}
示例15: CreateActions
private Widget CreateActions()
{
actionsVBox = new VBox(false, 0);
actionsVBox.WidthRequest = 175;
Label l = new Label("<span size=\"small\"></span>");
actionsVBox.PackStart(l, false, false, 0);
l.UseMarkup = true;
l = new Label(
string.Format(
"<span size=\"large\">{0}</span>",
Util.GS("Domain List")));
actionsVBox.PackStart(l, false, false, 0);
l.UseMarkup = true;
l.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
l.Xalign = 0.0F;
string lable = null;
ViewUserDomainList = ComboBox.NewText();
actionsVBox.PackStart(ViewUserDomainList, false, true, 0);
ViewUserDomainList.Changed += new EventHandler(OnComboBoxIndexChange);
actionsVBox.PackStart(new Label(""), false, false, 4);
lable = Util.GS("N/A");
lable = string.Format(Util.GS("User: {0}"),lable);
labelUser = new Label( string.Format( "<span size=\"medium\">{0}</span>",lable ));
actionsVBox.PackStart(labelUser, false, false, 0);
labelUser.UseMarkup = true;
labelUser.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
labelUser.Xalign = 0.0F;
lable = Util.GS("N/A");
lable = string.Format(Util.GS("Server: {0}"),lable);
labelServer = new Label( string.Format( "<span size=\"medium\">{0}</span>", lable));
actionsVBox.PackStart(labelServer, false, false, 0);
labelServer.UseMarkup = true;
labelServer.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
labelServer.Xalign = 0.0F;
actionsVBox.PackStart(new Label(""), false, false, 0);
lable = Util.GS("N/A");
lable = string.Format(Util.GS("No. of iFolder: {0}"),lable);
labeliFolderCount = new Label( string.Format( "<span size=\"medium\">{0}</span>", lable));
actionsVBox.PackStart(labeliFolderCount, false, false, 0);
labeliFolderCount.UseMarkup = true;
labeliFolderCount.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
labeliFolderCount.Xalign = 0.0F;
actionsVBox.PackStart(new Label(""), false, false, 0);
lable = "";
lable = string.Format(Util.GS("Disk Quota: {0}"),lable);
labelDiskQuota = new Label( string.Format( "<span size=\"medium\">{0}</span>", lable));
actionsVBox.PackStart(labelDiskQuota, false, false, 0);
labelDiskQuota.UseMarkup = true;
labelDiskQuota.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
labelDiskQuota.Xalign = 0.0F;
lable = Util.GS("N/A");
lable = string.Format(Util.GS("Used:") + lable);
labeliDiskUsed = new Label( string.Format( "<span size=\"medium\">{0}</span>", lable));
actionsVBox.PackStart(labeliDiskUsed, false, false, 0);
labeliDiskUsed.UseMarkup = true;
labeliDiskUsed.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
labeliDiskUsed.Xalign = 0.0F;
lable = Util.GS("N/A");
lable = string.Format(Util.GS("Available:") + lable);
labeliDiskAvailable = new Label( string.Format( "<span size=\"medium\">{0}</span>", lable));
actionsVBox.PackStart(labeliDiskAvailable, false, false, 0);
labeliDiskAvailable.UseMarkup = true;
labeliDiskAvailable.ModifyFg(StateType.Normal, this.Style.Base(StateType.Selected));
labeliDiskAvailable.Xalign = 0.0F;
actionsVBox.PackStart(new Label(""), false, false, 4);
serverStat = new Button();
serverStat.Label = Util.GS("N/A");
serverStat.Clicked += new EventHandler(OnserverStatButtonHandler);
actionsVBox.PackStart(serverStat, false, false, 0);
actionsVBox.PackStart(new Label(""), false, false, 4);
serverImg = new Gtk.Image();
serverImg.Pixbuf = new Gdk.Pixbuf(Util.ImagesPath("ifolder_discon_128.png"));
actionsVBox.PackStart(serverImg, false, false, 0);
return actionsVBox;
}