当前位置: 首页>>代码示例>>C#>>正文


C# TextDocument.FindControlById方法代码示例

本文整理汇总了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");
		}
开发者ID:rabidbob,项目名称:aodl-reloaded,代码行数:57,代码来源:ODFFormsTest.cs

示例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");
			
		}
开发者ID:rabidbob,项目名称:aodl-reloaded,代码行数:30,代码来源:ODFFormsTest.cs


注:本文中的AODL.Document.TextDocuments.TextDocument.FindControlById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。