本文整理汇总了C#中Gtk.VBox.CheckResize方法的典型用法代码示例。如果您正苦于以下问题:C# VBox.CheckResize方法的具体用法?C# VBox.CheckResize怎么用?C# VBox.CheckResize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.VBox
的用法示例。
在下文中一共展示了VBox.CheckResize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnTogglebuttonToggled
protected void OnTogglebuttonToggled(object sender, System.EventArgs e)
{
if (addNewOperation_togglebutton.Active)
{
Menu menu = new Menu();
int w, h;
menu.GetSizeRequest(out w, out h);
int menu_width = left_vbox.Allocation.Width;
menu.SetSizeRequest(menu_width, h);
Dictionary<MenuItem, Type> stage_operation_types = new Dictionary<MenuItem, Type>();
for (int i = 0; i < mStageOperationTypes.Length; i++)
{
string name = StageOperationDescriptionAttribute.GetName(mStageOperationTypes[i]);
if (name == null) name = mStageOperationTypes[i].Name;
string description = StageOperationDescriptionAttribute.GetDescription(mStageOperationTypes[i]);
MenuItem item = new MenuItem();
VBox item_vbox = new VBox();
item_vbox.BorderWidth = 4;
item_vbox.Show();
Label lbl_name = new Label();
lbl_name.Text = name;
lbl_name.Justify = Justification.Left;
lbl_name.Xalign = 0;
// Setting the name font
double name_size_k = 1.1;
Pango.FontDescription name_fd = FontHelpers.ScaleFontSize(lbl_name, name_size_k);
name_fd.Weight = Pango.Weight.Bold;
lbl_name.ModifyFont(name_fd);
item_vbox.Add(lbl_name);
lbl_name.Show();
if (description != null && description != "")
{
Label lbl_desc = new Label(description);
lbl_desc.LineWrapMode = Pango.WrapMode.Word;
lbl_desc.LineWrap = true;
lbl_desc.Wrap = true;
// Setting the description font
double desc_size_k = 0.9;
Pango.FontDescription desc_fd = FontHelpers.ScaleFontSize(lbl_desc, desc_size_k);
lbl_desc.ModifyFont(desc_fd);
item_vbox.Add(lbl_desc);
lbl_desc.Show();
item_vbox.SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
lbl_desc.WidthRequest = args.Allocation.Width - 10;
};
}
item.Child = item_vbox;
stage_operation_types.Add(item, mStageOperationTypes[i]);
item.Activated += delegate(object s, EventArgs ea) {
mStage.CreateAndAddNewItem(stage_operation_types[(MenuItem)s]).Active = true;
GtkScrolledWindow.HscrollbarPolicy = PolicyType.Never;
GtkScrolledWindow.Vadjustment.Value = GtkScrolledWindow.Vadjustment.Upper;
ArrangeVBoxes();
};
menu.Append(item);
item_vbox.CheckResize();
//lbl_desc.WidthRequest = ww;
}
menu.Deactivated += delegate {
addNewOperation_togglebutton.Active = false;
};
menu.ShowAll();
menu.Popup(null, null, delegate (Menu m, out int x, out int y, out bool push_in) {
int x1, y1, x0, y0;
GdkWindow.GetOrigin(out x0, out y0);
left_vbox.TranslateCoordinates(this, 0, 0, out x1, out y1);
x = x0 + x1;
y = y0 + y1;
push_in = false;
}, 0, 0);
}
}