本文整理汇总了C#中Gtk.Table.Resize方法的典型用法代码示例。如果您正苦于以下问题:C# Table.Resize方法的具体用法?C# Table.Resize怎么用?C# Table.Resize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Gtk.Table
的用法示例。
在下文中一共展示了Table.Resize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResizeTable
private void ResizeTable(Table table, int columns, IList<Widget> list)
{
RemoveContainerEntries(table);
double rows = (double)list.Count / (double)columns;
double remainder = rows - (int)rows;
if(remainder != 0.0) {
rows++;
}
if(rows > 0 && columns > 0) {
table.Resize((uint)rows, (uint)columns);
}
}
示例2: LoadControlTable
private void LoadControlTable(Table table, bool advanced)
{
while(table.Children.Length > 0) {
table.Remove(table.Children[0]);
}
table.Resize(1, 1);
table.RowSpacing = 5;
table.ColumnSpacing = 12;
uint y = 0;
foreach(PipelineVariable variable in profile.Pipeline) {
if(advanced != variable.Advanced) {
continue;
}
Label label = new Label();
label.Show();
label.Markup = String.Format("<b>{0}:</b>", GLib.Markup.EscapeText(variable.Name));
label.Xalign = 0.0f;
try {
Widget control = BuildControl(variable);
if(control == null) {
throw new ApplicationException("Control could not be created");
}
variable_widgets.Add(variable.Id, control);
if(variable.ControlType != PipelineVariableControlType.Check) {
variable_widgets.Add(".label." + variable.Id, label);
}
control.Show();
table.Resize(y + 1, 2);
if(variable.ControlType != PipelineVariableControlType.Check) {
table.Attach(label, 0, 1, y, y + 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
}
table.Attach(control, 1, 2, y, y + 1,
control is ComboBox ? AttachOptions.Fill : AttachOptions.Fill | AttachOptions.Expand,
AttachOptions.Fill, 0,
(uint)(variable.ControlType == PipelineVariableControlType.Check ? 2 : 0));
y++;
} catch {
}
}
foreach(Widget widget in variable_widgets.Values) {
if(widget is PipelineVariableComboBox) {
OnComboChanged(widget, EventArgs.Empty);
} else if(widget is CheckButton) {
(widget as CheckButton).Toggle();
}
}
table.Visible = y > 0;
}
示例3: AddTabAndSlidersFor
private void AddTabAndSlidersFor(Type t)
{
Table table = new Table(1,1,false);
notebook.AppendPage(table, new Label(t.Name));
uint fieldCount = 0;
foreach (var field in t.GetFields()) {
if (field.FieldType == typeof(float) &&
field.IsPublic && field.IsStatic) {
HScale hscale = new HScale(0, 1, 0.01);
hscale.Digits = 2;
foreach (var attribute in field.GetCustomAttributes(false)) {
if (attribute is RangeAttribute) {
var range = (RangeAttribute)attribute;
hscale.Adjustment.Upper = range.m_max;
hscale.Adjustment.Lower = range.m_min;
hscale.Digits = range.m_places;
break;
}
}
hscale.Value = (float)field.GetValue(null);
var localField = field;
hscale.ValueChanged += (obj, args) => {
localField.SetValue(null, (float)hscale.Value);
};
table.Resize(fieldCount+1, 2);
Label label = new Label(field.Name);
table.Attach(label , 0, 1, fieldCount, fieldCount+1);
table.Attach(hscale, 1, 2, fieldCount, fieldCount+1);
table.Homogeneous = false;
table.ShowAll();
fieldCount++;
}
}
}