本文整理汇总了C#中Gtk.Label.SetAlignment方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.Label.SetAlignment方法的具体用法?C# Gtk.Label.SetAlignment怎么用?C# Gtk.Label.SetAlignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Label
的用法示例。
在下文中一共展示了Gtk.Label.SetAlignment方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewLabel
public static Gtk.Label NewLabel ()
{
Gtk.Label label = new Gtk.Label ();
label.SetAlignment (0.0f, 0.5f);
label.Selectable = true;
return label;
}
示例2: Header
public Header(string text)
: base()
{
base.SetSizeRequest (-1, 30);
Gtk.Alignment alignment = new Gtk.Alignment (0, 0, 1, 1);
alignment.TopPadding = 1;
alignment.LeftPadding = 5;
alignment.RightPadding = 0;
alignment.BottomPadding = 1;
base.Add (alignment);
//Select ();
Gtk.HBox box = new Gtk.HBox ();
alignment.Add (box);
label = new Gtk.Label ();
label.Ypad = 3;
// label.Xpad = 3;
//base.Add (label);
box.PackStart (label, true, true, 0);
label.SetAlignment (0f, 0.5f);
label.Justify = Gtk.Justification.Left;
label.Markup = "<b>" + text + "</b>";
closeButton = new Gtk.Button ();
closeButton.Add (new Gtk.Image ("gtk-close", Gtk.IconSize.Menu));
closeButton.Relief = Gtk.ReliefStyle.None;
box.PackEnd (closeButton, false, false, 0);
closeButton.ShowAll ();
label.Show ();
box.Show ();
alignment.Show ();
closeButton.Clicked += closeButton_Clicked;
}
示例3: MessageDialog
public MessageDialog ()
{
Resizable = false;
HasSeparator = false;
BorderWidth = 12;
label = new Gtk.Label ();
label.LineWrap = true;
label.Selectable = true;
label.UseMarkup = true;
label.SetAlignment (0.0f, 0.0f);
secondaryLabel = new Gtk.Label ();
secondaryLabel.LineWrap = true;
secondaryLabel.Selectable = true;
secondaryLabel.UseMarkup = true;
secondaryLabel.SetAlignment (0.0f, 0.0f);
icon = new Gtk.Image (Gtk.Stock.DialogInfo, Gtk.IconSize.Dialog);
icon.SetAlignment (0.5f, 0.0f);
Gtk.StockItem item = Gtk.Stock.Lookup (icon.Stock);
Title = item.Label;
Gtk.HBox hbox = new Gtk.HBox (false, 12);
Gtk.VBox vbox = new Gtk.VBox (false, 12);
vbox.PackStart (label, false, false, 0);
vbox.PackStart (secondaryLabel, true, true, 0);
hbox.PackStart (icon, false, false, 0);
hbox.PackStart (vbox, true, true, 0);
VBox.PackStart (hbox, false, false, 0);
hbox.ShowAll ();
Buttons = Gtk.ButtonsType.OkCancel;
}
示例4: Rebuild
//.........这里部分代码省略.........
ymax = (uint)Math.Max(ymax, y + h);
x = positions[i][2][0] + 1;
y = positions[i][2][1] + 1;
w = 1;
h = positions[i][2][2];
line = new Gtk.DrawingArea();
line.ExposeEvent += Line_Expose;
rela = false;
if (famLink != null && (famLink.Pedigree == PedegreeLinkageType.Birth || famLink.Pedigree == PedegreeLinkageType.Unknown))
{
line.AddEvents((int)Gdk.EventMask.ButtonPressMask);
rela = true;
}
lineData = new Pair<int,bool>();
lineData.First = i * 2 + 2;
lineData.Second = rela;
_lines[line] = lineData;
table.Attach(line, x, x + w, y, y + h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);
xmax = (uint)Math.Max(xmax, x + w);
ymax = (uint)Math.Max(ymax, y + h);
}
// marriage data
if (_showMarriageData && positions[i].Length > 3)
{
string text = string.Empty;
if (famLink != null && (famLink.Pedigree == PedegreeLinkageType.Birth || famLink.Pedigree == PedegreeLinkageType.Unknown))
{
text = "foo";
}
Gtk.Label label = new Gtk.Label(text);
label.Justify = Gtk.Justification.Left;
label.LineWrap = true;
label.SetAlignment(0.1F, 0.5F);
x = positions[i][3][0] + 1;
y = positions[i][3][1] + 1;
w = positions[i][3][2];
h = positions[i][3][3];
table.Attach(label, x, x + w, y, y + h, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);
}
}
// nav arrows
if (lst[0] != null)
{
Gtk.Button arrowButton = new Gtk.Button();
arrowButton.Add(new Gtk.Arrow(Gtk.ArrowType.Left, Gtk.ShadowType.In));
arrowButton.Sensitive = (_dummyFam.Children.Count > 0);
arrowButton.Clicked += ArrowButton_Click;
if (arrowButton.Sensitive)
{
arrowButton.TooltipText = "Jump to child...";
}
uint ymid = (uint)Math.Floor(ymax / 2.0F);
table.Attach(arrowButton, 0, 1, ymid, ymid + 1, 0, 0, 0, 0);
// father
arrowButton = new Gtk.Button();
arrowButton.Add(new Gtk.Arrow(Gtk.ArrowType.Right, Gtk.ShadowType.In));
arrowButton.Sensitive = (lst[1] != null);
arrowButton.Clicked += FatherButton_Click;
if (arrowButton.Sensitive)
{
arrowButton.TooltipText = "Jump to father";
}
ymid = (uint)Math.Floor(ymax / 4.0F);
table.Attach(arrowButton, xmax, xmax + 1, ymid - 1, ymid + 2, 0, 0, 0, 0);
// mother
arrowButton = new Gtk.Button();
arrowButton.Add(new Gtk.Arrow(Gtk.ArrowType.Right, Gtk.ShadowType.In));
arrowButton.Sensitive = (lst[2] != null);
arrowButton.Clicked += MotherButton_Click;
if (arrowButton.Sensitive)
{
arrowButton.TooltipText = "Jump to mother";
}
ymid = (uint)Math.Floor(ymax / 4.0F * 3);
table.Attach(arrowButton, xmax, xmax + 1, ymid - 1, ymid + 2, 0, 0, 0, 0);
// dummy widgets to allow pedigree to be centred
Gtk.Label l = new Gtk.Label(string.Empty);
table.Attach(l, 0, 1, 0, 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0);
l = new Gtk.Label(string.Empty);
table.Attach(l, xmax, xmax + 1, ymax, ymax + 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0);
table.ShowAll();
}
}
示例5: HigMessageDialog
public HigMessageDialog (Gtk.Window parent,
Gtk.DialogFlags flags,
Gtk.MessageType type,
Gtk.ButtonsType buttons,
string header,
string msg) : base ()
{
HasSeparator = false;
BorderWidth = 5;
Resizable = false;
Title = "";
VBox.Spacing = 12;
ActionArea.Layout = Gtk.ButtonBoxStyle.End;
accel_group = new Gtk.AccelGroup ();
AddAccelGroup (accel_group);
Gtk.HBox hbox = new Gtk.HBox (false, 12);
hbox.BorderWidth = 5;
hbox.Show ();
VBox.PackStart (hbox, false, false, 0);
Gtk.Image image = null;
switch (type) {
case Gtk.MessageType.Error:
image = new Gtk.Image (Gtk.Stock.DialogError, Gtk.IconSize.Dialog);
break;
case Gtk.MessageType.Question:
image = new Gtk.Image (Gtk.Stock.DialogQuestion, Gtk.IconSize.Dialog);
break;
case Gtk.MessageType.Info:
image = new Gtk.Image (Gtk.Stock.DialogInfo, Gtk.IconSize.Dialog);
break;
case Gtk.MessageType.Warning:
image = new Gtk.Image (Gtk.Stock.DialogWarning, Gtk.IconSize.Dialog);
break;
}
image.Show ();
hbox.PackStart (image, false, false, 0);
Gtk.VBox label_vbox = new Gtk.VBox (false, 0);
label_vbox.Show ();
hbox.PackStart (label_vbox, true, true, 0);
string title = String.Format ("<span weight='bold' size='larger'>{0}" +
"</span>\n",
header);
Gtk.Label label;
label = new Gtk.Label (title);
label.UseMarkup = true;
label.Justify = Gtk.Justification.Left;
label.LineWrap = true;
label.SetAlignment (0.0f, 0.5f);
label.Show ();
label_vbox.PackStart (label, false, false, 0);
label = new Gtk.Label (msg);
label.UseMarkup = true;
label.Justify = Gtk.Justification.Left;
label.LineWrap = true;
label.SetAlignment (0.0f, 0.5f);
label.Show ();
label_vbox.PackStart (label, false, false, 0);
switch (buttons) {
case Gtk.ButtonsType.None:
break;
case Gtk.ButtonsType.Ok:
AddButton (Gtk.Stock.Ok, Gtk.ResponseType.Ok, true);
break;
case Gtk.ButtonsType.Close:
AddButton (Gtk.Stock.Close, Gtk.ResponseType.Close, true);
break;
case Gtk.ButtonsType.Cancel:
AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, true);
break;
case Gtk.ButtonsType.YesNo:
AddButton (Gtk.Stock.No, Gtk.ResponseType.No, false);
AddButton (Gtk.Stock.Yes, Gtk.ResponseType.Yes, true);
break;
case Gtk.ButtonsType.OkCancel:
AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, false);
AddButton (Gtk.Stock.Ok, Gtk.ResponseType.Ok, true);
break;
}
if (parent != null)
TransientFor = parent;
if ((int) (flags & Gtk.DialogFlags.Modal) != 0)
Modal = true;
if ((int) (flags & Gtk.DialogFlags.DestroyWithParent) != 0)
DestroyWithParent = true;
}
示例6: AddSnippet
public Gtk.Label AddSnippet ()
{
AddNewLine ();
snippet = WidgetFu.NewLabel ();
snippet.SetAlignment (0.0f, 0.0f);
snippet.Selectable = true;
WidgetFu.EllipsizeLabel (snippet);
snippet.Show ();
Attach (snippet, 1, 2, current_row, ++current_row, expand, fill, 0, 0);
maximized = false;
snippet_tip = new Gtk.Tooltips ();
return snippet;
}
示例7: AskForLoginData
public AskForLoginData(string label, string username, string password)
{
HasSeparator = false;
BorderWidth = 5;
Resizable = false;
Title = "";
VBox.Spacing = 12;
ActionArea.Layout = Gtk.ButtonBoxStyle.End;
Gtk.Button button = new Gtk.Button (Gtk.Stock.Cancel);
AddActionWidget (button, Gtk.ResponseType.Cancel);
button = new Gtk.Button (Gtk.Stock.Ok);
AddActionWidget (button, Gtk.ResponseType.Ok);
Gtk.HBox hbox = new Gtk.HBox (false, 12);
hbox.BorderWidth = 5;
VBox.PackStart(hbox, false, false, 0);
Gtk.Image image = new Gtk.Image(Gtk.Stock.DialogQuestion, Gtk.IconSize.Dialog);
image.Yalign = 0;
hbox.PackStart (image, false, false, 0);
Gtk.VBox content_vbox = new Gtk.VBox (false, 12);
hbox.PackStart (content_vbox, true, true, 0);
string title = String.Format ("<span weight='bold' size='larger'>{0} {1}</span>\n",
Catalog.GetString("Login to"), label);
Gtk.Label l = new Gtk.Label(title);
l.UseMarkup = true;
l.Justify = Gtk.Justification.Left;
l.LineWrap = true;
l.SetAlignment (0.0f, 0.5f);
content_vbox.PackStart(l, false, false, 0);
l = new Gtk.Label(Catalog.GetString("Username:"));
l.Justify = Gtk.Justification.Left;
l.LineWrap = true;
l.SetAlignment (0.0f, 0.5f);
content_vbox.PackStart(l, false, false, 0);
_username = new Gtk.Entry();
_username.Text = username;
content_vbox.PackStart(_username, false, false, 0);
l = new Gtk.Label(Catalog.GetString("Password:"));
l.Justify = Gtk.Justification.Left;
l.LineWrap = true;
l.SetAlignment (0.0f, 0.5f);
content_vbox.PackStart(l, false, false, 0);
_password = new Gtk.Entry();
_password.Visibility = false;
_password.Text = password;
content_vbox.PackStart(_password, false, false, 0);
_save = new Gtk.CheckButton ("Save info");
_save.Active = false;
content_vbox.PackStart (_save, false, false, 0);
ShowAll ();
}
示例8: BlogListView
public BlogListView(XmlNodeList elements)
: base()
{
HasSeparator = false;
BorderWidth = 5;
Resizable = false;
Title = "";
VBox.Spacing = 12;
ActionArea.Layout = Gtk.ButtonBoxStyle.End;
Gtk.Button button = new Gtk.Button (Gtk.Stock.Cancel);
AddActionWidget (button, Gtk.ResponseType.Cancel);
button = new Gtk.Button (Gtk.Stock.Ok);
AddActionWidget (button, Gtk.ResponseType.Ok);
Gtk.HBox hbox = new Gtk.HBox (false, 12);
hbox.BorderWidth = 5;
VBox.PackStart(hbox, false, false, 0);
Gtk.Image image = new Gtk.Image(Gtk.Stock.DialogQuestion, Gtk.IconSize.Dialog);
image.Yalign = 0;
hbox.PackStart (image, false, false, 0);
Gtk.VBox content_vbox = new Gtk.VBox (false, 12);
hbox.PackStart (content_vbox, true, true, 0);
string title = String.Format ("<span weight='bold' size='larger'>{0}</span>\n",
Catalog.GetString("Multiple blogs"));
Gtk.Label l = new Gtk.Label(title);
l.UseMarkup = true;
l.Justify = Gtk.Justification.Left;
l.LineWrap = true;
l.SetAlignment (0.0f, 0.5f);
content_vbox.PackStart(l, false, false, 0);
l = new Gtk.Label(Catalog.GetString("I found serveral blogs. Please chose which one you would like to send your post to."));
l.UseMarkup = true;
l.Justify = Gtk.Justification.Left;
l.LineWrap = true;
l.SetAlignment (0.0f, 0.5f);
content_vbox.PackStart(l, false, false, 0);
item_list = Gtk.ComboBox.NewText();
name_to_node = new Hashtable();
foreach (XmlNode node in elements)
{
string text = node.SelectSingleNode ("label/text()").Value;
item_list.AppendText (text);
name_to_node[text] = node;
}
content_vbox.PackStart (item_list, false, false, 0);
ShowAll ();
}
示例9: MakeLabel
// Utilities...
static Gtk.Label MakeLabel (string label_text, params object[] args)
{
if (args.Length > 0)
label_text = String.Format (label_text, args);
Gtk.Label label = new Gtk.Label (label_text);
label.UseMarkup = true;
label.Justify = Gtk.Justification.Left;
label.SetAlignment (0.0f, 0.5f);
label.Show ();
return label;
}
示例10: EditBlog
public EditBlog(string default_label, string default_url, string default_username, string default_password)
: base()
{
HasSeparator = false;
BorderWidth = 5;
Resizable = false;
Title = "";
VBox.Spacing = 12;
ActionArea.Layout = Gtk.ButtonBoxStyle.End;
Gtk.Button button = new Gtk.Button (Gtk.Stock.Cancel);
AddActionWidget (button, Gtk.ResponseType.Cancel);
button = new Gtk.Button (Gtk.Stock.Close);
AddActionWidget (button, Gtk.ResponseType.Ok);
Gtk.HBox hbox = new Gtk.HBox (false, 12);
hbox.BorderWidth = 5;
VBox.PackStart(hbox, false, false, 0);
Gtk.Image image = new Gtk.Image(Gtk.Stock.DialogQuestion, Gtk.IconSize.Dialog);
image.Yalign = 0;
hbox.PackStart (image, false, false, 0);
Gtk.VBox content_vbox = new Gtk.VBox (false, 12);
hbox.PackStart (content_vbox, true, true, 0);
string title = String.Format ("<span weight='bold' size='larger'>{0}</span>\n",
Catalog.GetString("Account information"));
Gtk.Label l = new Gtk.Label(title);
l.UseMarkup = true;
l.Justify = Gtk.Justification.Left;
l.LineWrap = true;
l.SetAlignment (0.0f, 0.5f);
content_vbox.PackStart(l, false, false, 0);
l = new Gtk.Label(Catalog.GetString("Enter the information for your blog in the corresponding fields"));
l.Justify = Gtk.Justification.Left;
l.LineWrap = true;
l.SetAlignment (0.0f, 0.5f);
content_vbox.PackStart(l, false, false, 0);
hbox = new Gtk.HBox();
content_vbox.PackStart(hbox, false, false, 0);
l = new Gtk.Label(Catalog.GetString("Label for this blog (only used internally)"));
l.Justify = Gtk.Justification.Left;
l.LineWrap = true;
l.SetAlignment (0.0f, 0.5f);
hbox.PackStart(l, false, false, 0);
this.label = new Gtk.Entry(default_label);
hbox.PackStart(this.label, false, false, 0);
hbox = new Gtk.HBox();
content_vbox.PackStart(hbox, false, false, 0);
l = new Gtk.Label(Catalog.GetString("URL to Atom Publishing Service or Collection document"));
l.Justify = Gtk.Justification.Left;
l.LineWrap = true;
l.SetAlignment (0.0f, 0.5f);
hbox.PackStart(l, false, false, 0);
this.url = new Gtk.Entry(default_url);
hbox.PackStart(this.url, false, false, 0);
hbox = new Gtk.HBox();
content_vbox.PackStart(hbox, false, false, 0);
l = new Gtk.Label(Catalog.GetString("Username"));
l.Justify = Gtk.Justification.Left;
l.LineWrap = true;
l.SetAlignment (0.0f, 0.5f);
hbox.PackStart(l, false, false, 0);
this.username = new Gtk.Entry(default_username);
hbox.PackStart(this.username, false, false, 0);
hbox = new Gtk.HBox();
content_vbox.PackStart(hbox, false, false, 0);
l = new Gtk.Label(Catalog.GetString("Password (optional. Will not be encrypted, just scrambled)"));
l.Justify = Gtk.Justification.Left;
l.LineWrap = true;
l.SetAlignment (0.0f, 0.5f);
hbox.PackStart(l, false, false, 0);
this.password = new Gtk.Entry(default_password);
this.password.Visibility = false;
hbox.PackStart(this.password, false, false, 0);
ShowAll ();
}