本文整理汇总了C#中Eto.Forms.DynamicLayout类的典型用法代码示例。如果您正苦于以下问题:C# DynamicLayout类的具体用法?C# DynamicLayout怎么用?C# DynamicLayout使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DynamicLayout类属于Eto.Forms命名空间,在下文中一共展示了DynamicLayout类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveItemsIndividuallyShouldClearParent
public void RemoveItemsIndividuallyShouldClearParent()
{
TestBase.Invoke(() =>
{
var layout = new DynamicLayout();
var items = new Control[] { new Label(), new Button(), new TextBox() };
foreach (var item in items)
layout.Add(item);
CollectionAssert.AreEqual(items, layout.Children, "#1. Items do not match");
foreach (var item in items)
Assert.AreEqual(layout, item.Parent, "#2. Items should have parent set to dynamic layout");
layout.Rows.RemoveAt(0);
Assert.IsNull(items[0].Parent, "#3. Item should have parent cleared when removed from dynamic layout");
layout.Rows[0] = new Button();
Assert.IsNull(items[1].Parent, "#4. Item should have parent cleared when replaced with another item in the dynamic layout");
Assert.AreEqual(layout, items[2].Parent, "#5. Item should not have changed parent as it is still in the dynamic layout");
});
}
示例2: About
public About ()
{
this.Title = "About Eto Test";
#if DESKTOP
this.Resizable = true;
#endif
var layout = new DynamicLayout (this);
layout.AddCentered(new ImageView{
Image = Icon.FromResource ("Eto.Test.TestIcon.ico"),
Size = new Size(128, 128)
}, true, true);
layout.Add (new Label{
Text = "Test Application",
Font = new Font(FontFamily.Sans, 16, FontStyle.Bold),
HorizontalAlign = HorizontalAlign.Center
});
var version = Assembly.GetEntryAssembly ().GetName ().Version;
layout.Add (new Label {
Text = string.Format("Version {0}", version),
HorizontalAlign = HorizontalAlign.Center
});
layout.Add (new Label{
Text = "Copyright 2011 by Curtis Wensley aka Eto",
HorizontalAlign = HorizontalAlign.Center
});
layout.AddCentered (CloseButton ());
}
示例3: TreeViewSection
public TreeViewSection()
{
var layout = new DynamicLayout();
layout.BeginHorizontal();
layout.Add(new Label());
layout.BeginVertical();
layout.BeginHorizontal();
layout.Add(null);
layout.Add(allowExpanding = new CheckBox{ Text = "Allow Expanding", Checked = true });
layout.Add(allowCollapsing = new CheckBox{ Text = "Allow Collapsing", Checked = true });
layout.Add(RefreshButton());
layout.Add(null);
layout.EndHorizontal();
layout.EndVertical();
layout.EndHorizontal();
treeView = ImagesAndMenu();
layout.AddRow(new Label{ Text = "Simple" }, Default());
layout.BeginHorizontal();
layout.Add(new Panel());
layout.BeginVertical();
layout.AddSeparateRow(InsertButton(), AddChildButton(), RemoveButton(), ExpandButton(), CollapseButton(), null);
layout.AddSeparateRow(LabelEditCheck(), EnabledCheck(), null);
layout.EndVertical();
layout.EndHorizontal();
layout.AddRow(new Label{ Text = "With Images\n&& Context Menu" }, treeView);
layout.AddRow(new Panel(), HoverNodeLabel());
layout.Add(null, false, true);
Content = layout;
}
示例4: PrintDialogSection
public PrintDialogSection()
{
this.DataContext = settings;
var layout = new DynamicLayout { DefaultSpacing = new Size(5, 5), Padding = new Padding(10) };
layout.BeginVertical();
layout.BeginHorizontal();
layout.Add(null);
layout.BeginVertical(Padding.Empty);
layout.AddSeparateRow(null, ShowPrintDialog(), null);
layout.AddSeparateRow(null, PrintFromGraphicsWithDialog(), null);
layout.AddSeparateRow(null, PrintFromGraphics(), null);
layout.EndBeginVertical();
layout.Add(PrintDialogOptions());
layout.Add(null);
layout.EndVertical();
layout.Add(null);
layout.EndHorizontal();
layout.EndVertical();
layout.AddSeparateRow(null, PageRange(), Settings(), null);
layout.Add(null);
Content = layout;
}
示例5: TransformSection
public TransformSection()
{
image = TestIcons.TestIcon;
font = Fonts.Sans(10);
var layout = new DynamicLayout();
var drawable = new Drawable { Size = canvasSize };
drawable.Paint += (sender, pe) => {
pe.Graphics.FillRectangle(Brushes.Black, pe.ClipRectangle);
MatrixTests(pe.Graphics);
};
layout.AddRow(new Label { Text = "Matrix" }, drawable);
drawable = new Drawable { Size = canvasSize };
drawable.Paint += (sender, pe) => {
pe.Graphics.FillRectangle(Brushes.Black, pe.ClipRectangle);
DirectTests(pe.Graphics);
};
layout.AddRow(new Label { Text = "Direct" }, drawable);
layout.Add(null);
var m = Matrix.Create();
m.Scale(100, 100);
var m2 = m.Clone();
m2.Translate(10, 10);
if (m == m2)
throw new Exception("Grr!");
Content = layout;
}
示例6: TabControlSection
public TabControlSection ()
{
var layout = new DynamicLayout (this);
layout.Add (DefaultTabs ());
}
示例7: ExpandedHeight
Control ExpandedHeight()
{
var layout = new DynamicLayout();
layout.Add(new Label { BackgroundColor = Colors.Red, Text = "Expanded Height" });
return new Scrollable { ExpandContentWidth = false, Content = layout };
}
示例8: JabbRAuthDialog
public JabbRAuthDialog(string serverAddress, string appName)
{
this.ServerAddress = serverAddress;
this.AppName = appName;
this.DisplayMode = DialogDisplayMode.Attached;
this.ClientSize = defaultSize;
this.Resizable = true;
this.Title = "JabbR Login";
var baseDir = Path.Combine(EtoEnvironment.GetFolderPath(EtoSpecialFolder.ApplicationResources), "Styles", "default");
webserver = new HttpServer(baseDir);
LocalhostTokenUrl = new Uri(webserver.Url, "Authorize");
webserver.StaticContent.Add("/", AuthHtml(true));
webserver.StaticContent.Add("/Authorize", GetUserIDHtml());
webserver.ReceivedRequest += HandleReceivedRequest;
web = new WebView();
web.DocumentLoaded += HandleDocumentLoaded;
web.Url = webserver.Url;
var layout = new DynamicLayout();
layout.Add(web, yscale: true);
layout.AddSeparateRow(Padding.Empty).Add(null, this.CancelButton());
Content = layout;
}
示例9: Generate
public override Control Generate (DynamicLayout layout)
{
if (rows.Count == 0)
return null;
int cols = rows.Max (r => r.Items.Count);
if (Container == null) {
Container = new Panel ();
this.Layout = new TableLayout (Container, cols, rows.Count);
}
else {
this.Layout = new TableLayout (null, cols, rows.Count);
Container.SetInnerLayout ();
}
var tableLayout = this.Layout;
var padding = this.Padding ?? layout.DefaultPadding;
if (padding != null)
tableLayout.Padding = padding.Value;
var spacing = this.Spacing ?? layout.DefaultSpacing;
if (spacing != null)
tableLayout.Spacing = spacing.Value;
for (int cy = 0; cy < rows.Count; cy++) {
var row = rows[cy];
for (int cx = 0; cx < row.Items.Count; cx++) {
var item = row.Items[cx];
item.Generate (layout, tableLayout, cx, cy);
}
}
return Container;
}
示例10: BrushSection
public BrushSection()
{
var layout = new DynamicLayout();
brush = solidBrush = Brushes.LightSkyBlue;
gradientBrush = new LinearGradientBrush(Colors.AliceBlue, Colors.Black, new PointF(0, 0), new PointF(100f, 100f));
//gradientBrush = new LinearGradientBrush (new RectangleF (0, 0, 50, 50), Colors.AliceBlue, Colors.Black, 10);
gradientBrush.Wrap = GradientWrapMode.Repeat;
textureBrush = new TextureBrush(image, 0.5f);
brush = textureBrush;
ScaleX = 100f;
ScaleY = 100f;
drawable = new Drawable { Size = new Size(300, 200) };
drawable.Paint += (sender, pe) => Draw(pe.Graphics);
layout.AddSeparateRow(null, BrushControl(), UseBackgroundColorControl(), null);
if (Platform.Supports<NumericUpDown>())
{
matrixRow = layout.AddSeparateRow(null, new Label { Text = "Rot" }, RotationControl(), new Label { Text = "Sx" }, ScaleXControl(), new Label { Text = "Sy" }, ScaleYControl(), new Label { Text = "Ox" }, OffsetXControl(), new Label { Text = "Oy" }, OffsetYControl(), null);
matrixRow.Table.Visible = false;
}
gradientRow = layout.AddSeparateRow(null, GradientWrapControl(), null);
gradientRow.Table.Visible = false;
layout.AddSeparateRow(null, drawable, null);
layout.Add(null);
this.Content = layout;
}
示例11: TreeGridViewSection
public TreeGridViewSection()
{
var layout = new DynamicLayout();
layout.BeginHorizontal();
layout.Add(new Label());
layout.BeginVertical();
layout.BeginHorizontal();
layout.Add(null);
layout.Add(allowExpanding = new CheckBox{ Text = "Allow Expanding", Checked = true });
layout.Add(allowCollapsing = new CheckBox{ Text = "Allow Collapsing", Checked = true });
layout.Add(null);
layout.EndHorizontal();
layout.EndVertical();
layout.EndHorizontal();
layout.AddRow(new Label{ Text = "Simple" }, Default());
layout.AddRow(new Label{ Text = "With Images\n&& Context Menu" }, ImagesAndMenu());
layout.AddRow(new Label{ Text = "Disabled" }, Disabled());
layout.Add(null, false, true);
Content = layout;
}
示例12: Init
void Init()
{
//_textBoxUrl
_textBoxUrl = new TextBox();
//_buttonReadFile
_buttonReadFile = new Button { Text = StrRes.GetString("StrLoad", "Load") };
_buttonReadFile.Click += _buttonReadFile_Click;
//_buttonSaveFile
_buttonSaveFile = new Button {Text = StrRes.GetString("StrSave","Save")};
_buttonSaveFile.Click += _buttonSaveFile_Click;
//_textAreaBody
_textAreaBody = new TextArea();
var layout = new DynamicLayout { Padding = new Padding(5, 5), Spacing = new Size(5, 5) };
layout.BeginVertical();
layout.BeginHorizontal();
layout.AddCentered(_textBoxUrl, xscale: true, horizontalCenter: false);
layout.AddCentered(_buttonReadFile, horizontalCenter: false);
layout.AddCentered(_buttonSaveFile, horizontalCenter: false);
layout.EndBeginHorizontal();
layout.EndVertical();
layout.AddRow(_textAreaBody);
Content = layout;
}
示例13: VerticalSection
Control VerticalSection()
{
var layout = new DynamicLayout { BackgroundColor = Colors.Blue };
layout.Add(new Panel { Size = new Size(50, 60), BackgroundColor = Colors.Lime });
layout.Add(new Panel { Size = new Size(50, 60), BackgroundColor = Colors.Lime });
return layout;
}
示例14: BadgeLabelSection
public BadgeLabelSection ()
{
var layout = new DynamicLayout (this);
layout.AddRow (null, SetBadgeLabel (), null);
layout.Add (null);
}
示例15: TextureBrushesSection
public TextureBrushesSection()
{
var layout = new DynamicLayout();
for (var i = 0; i < 10; ++i)
{
var w = image.Size.Width / 3; // same as height
var img = image;
if (i > 0)
img = img.Clone(new Rectangle((i - 1) % 3 * w, (i - 1) / 3 * w, w, w));
var brush = new TextureBrush(img);
var drawable = new Drawable { Size = image.Size * 2 };
drawable.Paint += (s, e) => {
var destRect = new RectangleF(new PointF(100, 100), image.Size);
var temp = brush.Transform; // save state
brush.Transform = Matrix.FromRotation(90);
e.Graphics.TranslateTransform(destRect.Location);
e.Graphics.FillRectangle(brush, new RectangleF(destRect.Size));
brush.Transform = temp;
};
layout.AddRow(drawable);
}
layout.Add(null);
Content = layout;
}