本文整理汇总了C#中Button.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Button.Add方法的具体用法?C# Button.Add怎么用?C# Button.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Button
的用法示例。
在下文中一共展示了Button.Add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InstantiateWidgets
protected void InstantiateWidgets()
{
IConfig defaults = config.Configs["defaults"];
IConfig labels = config.Configs["labels"];
maxLevel = defaults.GetInt("maxLevel");
calc = new LevelCalculator(maxLevel);
Arrow arrowDown = new Arrow(ArrowType.Down, ShadowType.None);
Arrow arrowUp = new Arrow(ArrowType.Up, ShadowType.None);
currentLevelDown = new Button();
currentLevelDown.Add(arrowDown);
currentLevelUp = new Button();
currentLevelUp.Add(arrowUp);
currentLevelLabel = new Label(labels.GetString("currentLevel"));
currentLevel = new Entry(defaults.GetInt("entrySize"));
currentLevel.SetSizeRequest(defaults.GetInt("entryWidth"), currentLevel.SizeRequest().Height);
blue = new LevelRangeWidget(labels.GetString("blue"));
darkwraith = new LevelRangeWidget(labels.GetString("darkwraith"), 0, calc.MaxLevel);
red = new LevelRangeWidget(labels.GetString("red"), 0, calc.MaxLevel);
white = new LevelRangeWidget(labels.GetString("white"));
vbox = new VBox(false, 1);
t = new Table((uint)defaults.GetInt("tableRows"), (uint)defaults.GetInt("tableCols"), false);
}
示例2: TabLabel
public TabLabel(string label)
: base(false, 2)
{
title = new Label (label);
this.PackStart (title, true, true, 0);
btn = new Button ();
btn.Add (new Gtk.Image (Stock.Close, IconSize.Menu));
btn.Relief = ReliefStyle.None;
btn.SetSizeRequest (18, 18);
this.PackStart (btn, false, false, 2);
this.ClearFlag (WidgetFlags.CanFocus);
this.ShowAll ();
}
示例3: AddItemToCurrentMarketGroup
void AddItemToCurrentMarketGroup(ECM.EveItem item, TreeModel model, TreeIter iter)
{
if (vbbMarketGroups.IsRealized == false)
vbbMarketGroups.Realize();
Image itemPic = new Image();
itemPic.PixbufAnimation = new Gdk.PixbufAnimation(ECM.Core.LoadingSpinnerGIF);
itemPic.WidthRequest = 64;
itemPic.HeightRequest = 64;
BackgroundWorker fetchImage = new BackgroundWorker();
fetchImage.DoWork += delegate(object sender, DoWorkEventArgs e)
{
itemPic.Pixbuf = ECM.API.ImageApi.GetItemImageGTK(item.ID, ECM.API.ImageApi.ImageRequestSize.Size64x64);
};
fetchImage.RunWorkerAsync();
Gdk.Pixbuf buf = new Gdk.Pixbuf(Gdk.Colorspace.Rgb, true, 8, 22, 22);
Gdk.Pixbuf book = new Gdk.Pixbuf(ECM.Core.Skillbook22PNG);
EveItemUseability useability = Core.CurrentCharacter.GetItemUseability(item);
if (useability == EveItemUseability.Untrainable)
buf.Fill(m_Untrainable.ToUint());
else if (useability == EveItemUseability.Trainable)
buf.Fill(m_Trainable.ToUint());
else
buf.Fill(m_Useable.ToUint());
book.Composite(buf, 0, 0, buf.Width, buf.Height, 0, 0, 1, 1, Gdk.InterpType.Hyper, 255);
Image skillsMet = new Image(buf);
skillsMet.WidthRequest = 22;
skillsMet.HeightRequest = 22;
skillsMet.Xalign = 0;
Pango.FontDescription font = new Pango.FontDescription();
font.Size = 24;
Label itemName = new Label();
itemName.UseMarkup = true;
itemName.Markup = string.Format("<span size=\"large\" weight=\"bold\">{0}</span>", item.Name);
itemName.Xalign = 0;
//itemName.ModifyFont(font);
Image infoPic = new Image(ECM.Core.Info16PNG);
infoPic.WidthRequest = 16;
infoPic.HeightRequest = 16;
Button btnInfo = new Button();
btnInfo.Relief = ReliefStyle.None;
btnInfo.Add(infoPic);
btnInfo.Clicked += delegate(object sender, EventArgs e)
{
m_ViewDetails.ShowItemDetails(item);
};
HBox itemNameHeader = new HBox();
itemNameHeader.PackStart(itemName, false, false, 0);
itemNameHeader.PackStart(btnInfo, false, false, 3);
WrapLabel itemDesc = new WrapLabel(item.Description);
Frame picFrame = new Frame();
picFrame.Shadow = ShadowType.Out;
picFrame.Add(itemPic);
VBox heading = new VBox();
heading.Spacing = 6;
heading.PackEnd(itemNameHeader, false, false, 0);
if(item.HasRequirements)
heading.PackEnd(skillsMet, false, false, 0);
HBox inner = new HBox();
inner.PackStart(picFrame, false, false, 0);
inner.PackStart(heading, true, true, 1);
Button viewDets = new Button(new Label("View Market Details"));
viewDets.Clicked += delegate(object sender, EventArgs e)
{
ShowItemMarketDetails(item, model, iter);
};
HButtonBox itemButtons = new HButtonBox();
itemButtons.Layout = ButtonBoxStyle.End;
itemButtons.BorderWidth = 3;
itemButtons.Add(viewDets);
itemButtons.ShowAll();
HSeparator sep = new HSeparator();
VBox itemBlock = new VBox();
itemBlock.Spacing = 10;
itemBlock.PackStart(inner, false, false, 0);
itemBlock.PackStart(itemDesc, true, true, 0);
itemBlock.PackEnd(itemButtons, false, false, 0);
itemBlock.ShowAll();
//.........这里部分代码省略.........
示例4: CreateAccountWidget
protected Widget CreateAccountWidget(ECM.Account account)
{
VBox accWidget = new VBox();
accWidget.Spacing = 3;
Label accKey = new Label(string.Format("Account #{0}", account.KeyID));
accKey.Xalign = 0;
HSeparator sep = new HSeparator();
Button delAccBtn = new Button();
delAccBtn.Relief = ReliefStyle.None;
delAccBtn.TooltipText = "Delete Account";
delAccBtn.Add(new Image("gtk-delete", IconSize.Menu));
delAccBtn.Clicked += delegate(object sender, EventArgs e)
{
//TODO: Make this work
Console.WriteLine(string.Format("Deleting Account #{0}", account.KeyID));
};
Button editAccBtn = new Button();
editAccBtn.Relief = ReliefStyle.None;
editAccBtn.TooltipText = "Edit Account";
editAccBtn.Add(new Image("gtk-edit", IconSize.Menu));
editAccBtn.Clicked += delegate(object sender, EventArgs e)
{
//TODO: Make this work
Console.WriteLine(string.Format("Editing Account #{0}", account.KeyID));
};
HBox accHeader = new HBox();
accHeader.Spacing = 2;
accHeader.PackStart(accKey, false, false, 0);
accHeader.PackStart(sep, true, true, 0);
accHeader.PackStart(editAccBtn, false, false, 0);
accHeader.PackStart(delAccBtn, false, false, 0);
accWidget.PackStart(accHeader, true, false, 0);
TextView accStats = new TextView();
accWidget.PackStart(accStats, true, false, 0);
TextTag expired = new TextTag("expired");
expired.Weight = Pango.Weight.Bold;
expired.Foreground = "red";
accStats.Editable = false;
accStats.Sensitive = false;
TimeSpan playTime = new TimeSpan(0, account.LogonMinutes, 0);
string paidUntilString = account.PaidUntil.ToLocalTime().ToString();
string accStatus = "Paid Until:";
if (account.PaidUntilExpired)
{
accKey.UseMarkup = true;
accKey.Markup = string.Format("<span foreground=\"red\" font_weight=\"bold\">{0}</span>", accKey.Text);
accStatus = "Expired:";
accStats.Buffer.TagTable.Add(expired);
}
accStats.Buffer.Text = string.Format("Time spent playing: {0}", ECM.Helper.GetDurationInWords(playTime));
TextIter itr = accStats.Buffer.GetIterAtLine(0);
accStats.Buffer.InsertWithTags(ref itr, string.Format("{0} {1}\n", accStatus, paidUntilString), expired);
foreach (ECM.Character ecmChar in account.Characters)
{
if (ecmChar.AutoUpdate)
accWidget.PackStart(CreateCharacterButton(ecmChar), true, false, 0);
}
accWidget.ShowAll();
return accWidget;
}