本文整理汇总了C#中Box.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# Box.Clear方法的具体用法?C# Box.Clear怎么用?C# Box.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Box
的用法示例。
在下文中一共展示了Box.Clear方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DisplayBookmarks
/// <summary>Display bookmark list to the XWT Box as an array of Buttons</summary>
/// <param name="box">The XWT box</param>
/// <param name="OnClick">What should happen if user clicks the bookmark</param>
/// <param name="s">The Stylist that should apply usertheme to the button (or null)</param>
public void DisplayBookmarks(Box box, Action<string> OnClick, Stylist s = null)
{
if(s==null) s = new Stylist();
box.Clear();
foreach (Bookmark b in bookmarks)
{
string url = b.url;
MenuButton NewBtn = new MenuButton(null, b.title);
if (b.SubMenu != null)
{
NewBtn.Type = ButtonType.DropDown;
NewBtn.Menu = GetBookmarkSubmenu(b, OnClick);
}
else
{ NewBtn.Clicked += (o, ea) => OnClick(url); }
NewBtn.CanGetFocus = false;
NewBtn.Style = ButtonStyle.Flat;
NewBtn.Margin = -3;
NewBtn.Cursor = CursorType.Hand;
NewBtn.Image = b.GetIcon();
s.Stylize(NewBtn);
box.PackStart(NewBtn);
}
}