本文整理汇总了C#中ImageButton.SizeRequest方法的典型用法代码示例。如果您正苦于以下问题:C# ImageButton.SizeRequest方法的具体用法?C# ImageButton.SizeRequest怎么用?C# ImageButton.SizeRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageButton
的用法示例。
在下文中一共展示了ImageButton.SizeRequest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetTitle
public void SetTitle(Gtk.Widget page, Gdk.Pixbuf icon, string label)
{
this.label = label;
this.page = page;
if (Child != null)
{
Gtk.Widget oc = Child; // keep a handle to the Child widget to prevent it from being garbage collected
Remove(oc); // remove Child from parent. After this, Child==null
oc.Destroy(); // now that no reference from the parent points to the child anymore, destroy it.
//oc.Dispose(); // not sure if this is additionally needed to .Destroy()
}
Gtk.HBox box = new HBox();
box.Spacing = 2;
if (icon != null)
{
tabIcon = new Gtk.Image(icon);
tabIcon.Show();
box.PackStart(tabIcon, false, false, 0);
}
else
tabIcon = null;
if (!string.IsNullOrEmpty(label))
{
labelWidget = new ExtendedLabel(label);
labelWidget.DropShadowVisible = true;
labelWidget.UseMarkup = true;
box.PackStart(labelWidget, true, true, 0);
}
else
{
labelWidget = null;
}
btnDock = new ImageButton();
btnDock.Image = pixAutoHide;
btnDock.TooltipText = "Minimize"; // previous text "Auto Hide" was misleading
btnDock.CanFocus = false;
// btnDock.WidthRequest = btnDock.HeightRequest = 17;
btnDock.Clicked += OnClickDock;
btnDock.ButtonPressEvent += (o, args) => args.RetVal = true;
btnDock.WidthRequest = btnDock.SizeRequest().Width;
btnClose = new ImageButton();
btnClose.Image = pixClose;
btnClose.TooltipText = "Close";
btnClose.CanFocus = false;
btnClose.WidthRequest = btnDock.SizeRequest().Width;
btnClose.Clicked += delegate { item.Close(); };
btnClose.ButtonPressEvent += (o, args) => args.RetVal = true;
Gtk.Alignment al = new Alignment(0, 0, 1, 1);
HBox btnBox = new HBox(false, 3);
btnBox.PackStart(btnDock, false, false, 0);
btnBox.PackStart(btnClose, false, false, 0);
al.Add(btnBox);
al.LeftPadding = 3;
al.TopPadding = 1;
box.PackEnd(al, false, false, 0);
Add(box);
// Get the required size before setting the ellipsize property, since ellipsized labels
// have a width request of 0
box.ShowAll();
Show();
UpdateBehavior();
UpdateVisualStyle();
}