本文整理汇总了C#中Eto.Forms.DynamicLayout.Generate方法的典型用法代码示例。如果您正苦于以下问题:C# DynamicLayout.Generate方法的具体用法?C# DynamicLayout.Generate怎么用?C# DynamicLayout.Generate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Eto.Forms.DynamicLayout
的用法示例。
在下文中一共展示了DynamicLayout.Generate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetWindow
protected override Forms.Window GetWindow()
{
// Add splitters like this:
// |---------------------------
// | | | |
// | P0 | P2 | P4 |
// | -------| | | <== These are on MainPanel
// | P1 |------| |
// | | P3 | |
// |---------------------------
// | status0..4, | <== These are on StatusPanel
// ----------------------------
Label[] status = new Label[] { new Label(), new Label(), new Label(), new Label(), new Label() };
// Status bar
var statusPanel = new Panel { };
var statusLayout = new DynamicLayout(Padding.Empty, Size.Empty);
statusLayout.BeginHorizontal();
for (var i = 0; i < status.Length; ++i)
statusLayout.Add(status[i], xscale: true);
statusLayout.EndHorizontal();
statusPanel.Content = statusLayout;
// Splitter windows
Panel[] p = new Panel[] { new Panel(), new Panel(), new Panel(), new Panel(), new Panel() };
var colors = new Color[] { Colors.PaleTurquoise, Colors.Olive, Colors.NavajoWhite, Colors.Purple, Colors.Orange };
var count = 0;
for (var i = 0; i < p.Length; ++i)
{
var temp = i;
//p[i].BackgroundColor = colors[i];
var button = new Button { Text = "Click to update status " + i.ToString(), BackgroundColor = colors[i] };
button.Click += (s, e) => status[temp].Text = "New count: " + (count++).ToString();
p[i].Content = button;
}
var p0_1 = new Splitter { Panel1 = p[0], Panel2 = p[1], Orientation = SplitterOrientation.Vertical, Position = 200 };
var p2_3 = new Splitter { Panel1 = p[2], Panel2 = p[3], Orientation = SplitterOrientation.Vertical, Position = 200 };
var p01_23 = new Splitter { Panel1 = p0_1, Panel2 = p2_3, Orientation = SplitterOrientation.Horizontal, Position = 200};
var p0123_4 = new Splitter { Panel1 = p01_23, Panel2 = p[4], Orientation = SplitterOrientation.Horizontal, Position = 400 };
// Main panel
var mainPanel = new Panel();
mainPanel.Content = p0123_4;
// Form's content
var layout = new DynamicLayout();
layout.Add(mainPanel, yscale: true);
layout.Add(statusPanel);
layout.Generate();
var form = new Form
{
Size = new Size(800, 600),
Content = layout
};
return form;
}
示例2: Test1
static Form Test1(bool setSize, Action<Label[], Panel> layoutContent)
{
// Status bar
Label[] status = { new Label(), new Label(), new Label(), new Label(), new Label() };
var statusLayout = new DynamicLayout(Padding.Empty, Size.Empty);
statusLayout.BeginHorizontal();
for (var i = 0; i < status.Length; ++i)
statusLayout.Add(status[i], xscale: true);
statusLayout.EndHorizontal();
// Main panel
var mainPanel = new Panel();
layoutContent(status, mainPanel);
// Form's content
var layout = new DynamicLayout();
layout.Add(mainPanel, yscale: true);
layout.Add(statusLayout);
layout.Generate();
var form = new Form { Content = layout };
if (setSize)
form.ClientSize = new Size(800, 600);
return form;
}