本文整理汇总了C#中AODL.Document.TextDocuments.TextDocument.FindControlById方法的典型用法代码示例。如果您正苦于以下问题:C# TextDocument.FindControlById方法的具体用法?C# TextDocument.FindControlById怎么用?C# TextDocument.FindControlById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AODL.Document.TextDocuments.TextDocument
的用法示例。
在下文中一共展示了TextDocument.FindControlById方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NestedFormTest
public void NestedFormTest()
{
//Create a new text document
TextDocument document = new TextDocument();
document.New();
// Create a main paragraph
Paragraph p =new Paragraph(document);
// Create a main form
ODFForm main_form = new ODFForm(document, "mainform");
ODFForm child_form = new ODFForm(document, "childform");
main_form.Method = Method.Get;
main_form.Method = Method.Get;
// Create a frame
ODFFrame frm = new ODFFrame(main_form, p.Content, "frm", "5mm", "5mm", "5cm", "3cm");
frm.Label = "Main form";
// Add the frame to the form control list
main_form.Controls.Add (frm);
// Create a button
ODFButton butt = new ODFButton(main_form, p.Content, "butt", "1cm", "15mm", "4cm", "1cm");
butt.Label = "This is a main form";
// Add the button to the form control list
main_form.Controls.Add (butt);
// Add the forms to the main form!
document.Forms.Add(main_form);
// Add the paragraph to the content list
document.Content.Add(p);
// adding controls to the nested form
ODFFrame frm_child = new ODFFrame(child_form, p.Content, "frm_child", "5mm", "35mm", "5cm", "3cm");
frm_child.Label = "Child form";
child_form.Controls.Add (frm_child);
ODFButton butt_child = new ODFButton(child_form, p.Content, "butt_child", "1cm", "45mm", "4cm", "1cm");
butt_child.Label = "This is a child form";
child_form.Controls.Add (butt_child);
main_form.ChildForms.Add(child_form);
ODFButton b = document.FindControlById("butt_child") as ODFButton;
Assert.IsNotNull(b, "Error! could not find the specified control");
b.Label = "Child form:)";
// Add the forms to the main form!
document.Forms.Add(main_form);
// Add the paragraph to the content list
document.Content.Add(p);
document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"nested_forms_test.odt");
document.Load(AARunMeFirstAndOnce.outPutFolder+"nested_forms_test.odt");
document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"nested_forms_test2.odt");
}
示例2: SaveLoadTest
public void SaveLoadTest()
{
//Create a new text document
TextDocument document = new TextDocument();
document.New();
Paragraph p =new Paragraph(document);
p.StyleName = "Standard";
ODFForm main_form = new ODFForm(document, "mainform");
main_form.Method = Method.Get;
ODFFrame frm = new ODFFrame(main_form, p.Content, "frm", "5mm", "5mm", "5cm", "3cm");
frm.Label = "Save and Load test";
main_form.Controls.Add (frm);
ODFButton butt = new ODFButton(main_form, p.Content, "butt", "1cm", "15mm", "4cm", "1cm");
butt.Label = "A simple button :)";
main_form.Controls.Add (butt);
document.Forms.Add(main_form);
document.Content.Add(p);
document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"saveload.odt");
document.Load(AARunMeFirstAndOnce.outPutFolder+"saveload.odt");
ODFButton bt = document.FindControlById("butt") as ODFButton;
Assert.IsNotNull(bt, "Could not find control with >butt< ID");
bt.Label = "This label has chanhed";
document.SaveTo(AARunMeFirstAndOnce.outPutFolder+"saveload2.odt");
}