本文整理汇总了C#中Panel.AddContentChild方法的典型用法代码示例。如果您正苦于以下问题:C# Panel.AddContentChild方法的具体用法?C# Panel.AddContentChild怎么用?C# Panel.AddContentChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Panel
的用法示例。
在下文中一共展示了Panel.AddContentChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateChildren
override protected void CreateChildren()
{
base.CreateChildren();
#region Top label
Label label = new TitleLabel { HorizontalCenter = 0, Top = 20, StyleName = "title" };
AddChild(label);
new TextRotator
{
Delay = 5, // 5 seconds delay
Lines = new[]
{
"Form Demo 2",
"Created with eDriven.Gui"/*,
"Author: Danko Kozar"*/
},
Callback = delegate(string line) { label.Text = line; }
}
.Start();
#endregion
#region Scroller
Scroller scroller = new Scroller
{
SkinClass = typeof(ScrollerSkin2),
Left = 0,
Right = 0,
Top = 100,
Bottom = 0
};
//scroller.SetStyle("horizontalScrollPolicy", ScrollPolicy.On);
//scroller.SetStyle("verticalScrollPolicy", ScrollPolicy.On);
AddChild(scroller);
Group viewport = new Group
{
MouseEnabled = true,
Layout = new VerticalLayout
{
HorizontalAlign = HorizontalAlign.Center,
VerticalAlign = VerticalAlign.Middle,
PaddingLeft = 10,
PaddingRight = 10,
PaddingTop = 0,
PaddingBottom = 10,
Gap = 10
}
};
scroller.Viewport = viewport;
#endregion
Panel panel = new Panel
{
Title = "Form Demo 2",
Icon = Resources.Load<Texture>("Icons/star"),
SkinClass = typeof(PanelSkin2),
MaxHeight = 800,
//Height = 600 // for getting a scrollbar
};
viewport.AddChild(panel);
Group container = new Group { Left = 10, Right = 10, Top = 10, Bottom = 10 };
panel.AddContentChild(container);
Form form = new Form {PercentWidth = 100};
container.AddContentChild(form);
#region Form items
List list = new List
{
PercentWidth = 100,
RequireSelection = true,
SelectedItem = "Sine",
DataProvider = new ArrayList(new List<object>
{
new ListItem("Back", "Back"),
new ListItem("Bounce", "Bounce"),
new ListItem("Circ", "Circ"),
new ListItem("Cubic", "Cubic"),
new ListItem("Elastic", "Elastic"),
new ListItem("Expo", "Expo"),
new ListItem("Linear", "Linear"),
new ListItem("Quad", "Quad"),
new ListItem("Quart", "Quart"),
new ListItem("Quint", "Quint"),
new ListItem("Sine", "Sine")
})
};
form.AddField("list", "List:", list);
DropDownList dropDown = new DropDownList
{
PercentWidth = 100,
DataProvider = new ArrayList(new List<object>
//.........这里部分代码省略.........
示例2: CreateChildren
override protected void CreateChildren()
{
base.CreateChildren();
#region Top label
Label label = new TitleLabel { HorizontalCenter = 0, Top = 20, StyleName = "title" };
AddChild(label);
new TextRotator
{
Delay = 5, // 5 seconds delay
Lines = new[]
{
"Form Demo 1",
"Created with eDriven.Gui"/*,
"Author: Danko Kozar"*/
},
Callback = delegate(string line) { label.Text = line; }
}
.Start();
#endregion
Panel panel = new Panel
{
Title = "Form Demo",
Icon = Resources.Load<Texture>("Icons/star"),
SkinClass = typeof(PanelSkin2),
//SkinClass = typeof(WindowSkin),
Width = 350,
MaxHeight = 500,
HorizontalCenter = 0, VerticalCenter = 0,
//Top = 100, Bottom = 100 // additional constrains for screen resize
};
AddChild(panel);
Group container = new Group { Left = 10, Right = 10, Top = 10, Bottom = 10 };
panel.AddContentChild(container);
Form form = new Form { PercentWidth = 100 };
container.AddContentChild(form);
#region Text Fields
TextField txtSubject = new TextField
{
FocusEnabled = true,
PercentWidth = 100,
Text = "Input text",
//Optimized = true
//AlowedCharacters = "a1"
};
form.AddField("subject", "Subject:", txtSubject);
TextArea txtMessage = new TextArea
{
FocusEnabled = true,
PercentWidth = 100,
Height = 200,
Text = LoremIpsum,
//Optimized = true
};
form.AddField("message", "Message:", txtMessage);
#endregion
#region Buttons
panel.ControlBarGroup.AddChild(new Spacer {PercentWidth = 100});
Button btnSet = new Button
{
Text = "Set data",
Icon = ImageLoader.Instance.Load("Icons/arrow_up"),
SkinClass = typeof(ImageButtonSkin)
};
btnSet.Press += delegate
{
form.Data = new Hashtable
{
{"subject", "The subject"},
{"message", "This is the message..."}
};
};
panel.ControlBarGroup.AddChild(btnSet);
btnSet.SetFocus();
Button btnGet = new Button
{
Text = "Get data",
SkinClass = typeof(ImageButtonSkin),
Icon = ImageLoader.Instance.Load("Icons/arrow_down")
};
btnGet.Press += delegate
{
StringBuilder sb = new StringBuilder();
foreach (DictionaryEntry entry in form.Data)
{
sb.AppendLine(string.Format(@"""{0}"": {1}", entry.Key, entry.Value));
//.........这里部分代码省略.........