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


C# IHTMLDiv.Add方法代码示例

本文整理汇总了C#中ScriptCoreLib.JavaScript.DOM.HTML.IHTMLDiv.Add方法的典型用法代码示例。如果您正苦于以下问题:C# IHTMLDiv.Add方法的具体用法?C# IHTMLDiv.Add怎么用?C# IHTMLDiv.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ScriptCoreLib.JavaScript.DOM.HTML.IHTMLDiv的用法示例。


在下文中一共展示了IHTMLDiv.Add方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CreateToolboxTo

		internal static void CreateToolboxTo(IHTMLDiv ToolboxContainer)
		{
			var items = new
			{
				img = default(IHTMLElement)
			}.ToEmptyList();

			Action<IHTMLElement> Add =
				img =>
				{
					img.style.cursor = ScriptCoreLib.JavaScript.DOM.IStyle.CursorEnum.move;

					new IHTMLDiv().With(
						div =>
						{
							var backgroundColor = default(Color);

							if (items.Count % 2 == 0)
								backgroundColor = Color.FromGray(0xf7);
							else
								backgroundColor = Color.FromGray(0xf0);

			

							//div.style.height = "90px";
							div.style.overflow = ScriptCoreLib.JavaScript.DOM.IStyle.OverflowEnum.hidden;
							div.style.textAlign = ScriptCoreLib.JavaScript.DOM.IStyle.TextAlignEnum.center;

							div.Add(
								img
							);

							img.title = "Drag this component into the designer!";

							items.Add(
								new
								{
									img = img
								}
							);

							ToolboxContainer.Add(div);

							ApplyMouseHoverStyle(div, backgroundColor);
						}
					);
				};

			Add(new JSCSolutionsNETImage());
			Add(new ToolboxIconsIHTMLButton());
			Add(new ToolboxIconsIHTMLInputCheckbox());
			Add(new ToolboxIconsIHTMLInputText());
			Add(new ToolboxIconsIHTMLTextarea());

		}
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:55,代码来源:VisualStudioView.cs

示例2: AddSection11

		private static void AddSection11(Action<string, IHTMLDiv> AddSection)
		{
			var ToolbarHeight = "24px";

			var Content = new IHTMLDiv().With(
				k =>
				{
					k.style.border = "1px solid gray";
					k.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.relative;
					k.style.width = "100%";
					k.style.height = "20em";
				}
			);

            //global::ScriptCoreLib.Ultra.Components.HTML
            // reload the project to make visual studio happy!
			new TwentyTenWorkspace().ToBackground(Content.style, true);

			var ToolbarContainerBackground = new IHTMLDiv().With(
				k =>
				{
					k.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute;
					k.style.left = "0px";
					k.style.right = "0px";
					k.style.top = "0px";
					k.style.height = ToolbarHeight;

					k.style.backgroundColor = Color.White;
					k.style.Opacity = 0.5;
				}
			).AttachTo(Content);

			var ToolbarContainer = new IHTMLDiv().With(
				k =>
				{
					k.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute;
					k.style.left = "0px";
					k.style.right = "0px";
					k.style.top = "0px";
					k.style.height = ToolbarHeight;


				}
			).AttachTo(Content);

			var PreviewContainer = new IHTMLDiv().With(
				k =>
				{
					k.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute;
					k.style.left = "0px";
					k.style.right = "0px";
					k.style.top = ToolbarHeight;
					k.style.bottom = "0px";
				}
			).AttachTo(Content);


			var PreviewFrame = new IHTMLIFrame { src = "about:blank" };

			PreviewFrame.style.width = "100%";
			PreviewFrame.style.height = "100%";
			PreviewFrame.style.border = "0";
			PreviewFrame.style.margin = "0";
			PreviewFrame.style.padding = "0";
			PreviewFrame.frameBorder = "0";
			PreviewFrame.border = "0";

			PreviewFrame.AttachTo(PreviewContainer);

			PreviewContainer.Hide();

			var EditorContainer = new IHTMLDiv().With(
				k =>
				{
					k.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute;
					k.style.left = "0px";
					k.style.right = "0px";
					k.style.top = ToolbarHeight;
					k.style.bottom = "0px";
				}
			).AttachTo(Content);

			var EditorFrame = VisualStudioView.CreateEditor().AttachTo(EditorContainer);

			PreviewFrame.allowTransparency = true;
			EditorFrame.allowTransparency = true;

			EditorFrame.WhenContentReady(
				body =>
				{
					body.style.backgroundColor = Color.Transparent;

					new IHTMLDiv
					{
						"Hello world :)"
					}.With(
						div =>
						{
							div.style.backgroundColor = Color.White;
							div.style.borderColor = Color.Gray;
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:Application.cs

示例3: AddSection10

		private static void AddSection10(Action<string, IHTMLDiv> AddSection)
		{

			var Content = new IHTMLDiv().With(
				k =>
				{
					k.style.border = "1px solid gray";
					k.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.relative;
					k.style.width = "100%";
					k.style.height = "20em";
				}
			);

			new TwentyTenWorkspace().ToBackground(Content.style, true);

			var ToolbarContainerBackground = new IHTMLDiv().With(
				k =>
				{
					k.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute;
					k.style.left = "0px";
					k.style.right = "0px";
					k.style.top = "0px";
					k.style.height = "2em";

					k.style.backgroundColor = Color.White;
					k.style.Opacity = 0.5;
				}
			).AttachTo(Content);

			var ToolbarContainer = new IHTMLDiv().With(
				k =>
				{
					k.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute;
					k.style.left = "0px";
					k.style.right = "0px";
					k.style.top = "0px";
					k.style.height = "2em";


				}
			).AttachTo(Content);

			var EditorContainer = new IHTMLDiv().With(
				k =>
				{
					k.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute;
					k.style.left = "0px";
					k.style.right = "0px";
					k.style.top = "2em";
					k.style.bottom = "0px";
				}
			).AttachTo(Content);

			var Editor = VisualStudioView.CreateEditor().AttachTo(EditorContainer);

			Editor.allowTransparency = true;

			Editor.WhenContentReady(
				body =>
				{
					body.style.backgroundColor = Color.Transparent;

					new IHTMLDiv
					{
						"Hello world :)"
					}.With(
						div =>
						{
							div.style.backgroundColor = Color.White;
							div.style.borderColor = Color.Gray;
							div.style.borderStyle = "solid";
							div.style.borderWidth = "1px";

							div.style.margin = "2em";
							div.style.padding = "2em";
						}
					).AttachTo(body);

				}
			);

			var ToolbarContent = new IHTMLDiv().AttachTo(ToolbarContainer);

			ToolbarContent.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.relative;

			Func<IHTMLImage, IHTMLButton> AddButtonDummy =
				(img) =>
				{
					return new IHTMLButton { img.WithinContainer() }.With(
						k =>
						{
							k.style.padding = "0";
							k.style.margin = "0";
							k.style.overflow = ScriptCoreLib.JavaScript.DOM.IStyle.OverflowEnum.hidden;
							k.style.SetSize(24, 24);

							VisualStudioView.ApplyMouseHoverStyle(k, Color.Transparent);
						}
					).AttachTo(ToolbarContent);
				};
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:Application.cs

示例4: AddSection9

		private static void AddSection9(Action<string, IHTMLDiv> AddSection)
		{

			var Content = new IHTMLDiv().With(
				k =>
				{
					k.style.border = "1px solid gray";
					k.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.relative;
					k.style.width = "100%";
					k.style.height = "20em";
				}
			);

			var ToolbarContainer = new IHTMLDiv().With(
				k =>
				{
					k.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute;
					k.style.left = "0px";
					k.style.right = "0px";
					k.style.top = "0px";
					k.style.height = "2em";
				}
			).AttachTo(Content);

			var EditorContainer = new IHTMLDiv().With(
				k =>
				{
					k.style.position = ScriptCoreLib.JavaScript.DOM.IStyle.PositionEnum.absolute;
					k.style.left = "0px";
					k.style.right = "0px";
					k.style.top = "2em";
					k.style.bottom = "0px";
				}
			).AttachTo(Content);

			var Editor = VisualStudioView.CreateEditor().AttachTo(EditorContainer);




			Func<IHTMLImage, IHTMLButton> AddButtonDummy =
				(img) =>
				{
					return new IHTMLButton { img }.With(
						k =>
						{
							k.style.padding = "0";
							k.style.margin = "0";
							k.style.overflow = ScriptCoreLib.JavaScript.DOM.IStyle.OverflowEnum.hidden;
							k.style.SetSize(24, 24);

							VisualStudioView.ApplyMouseHoverStyle(k, Color.FromGray(0xf0));
						}
					).AttachTo(ToolbarContainer);
				};

			Func<IHTMLImage, string, IHTMLButton> AddButton =
				(img, command) =>
				{
					return AddButtonDummy(img).With(
						k =>
						{
							k.onclick +=
								delegate
								{
									Editor.contentWindow.document.execCommand(
										command, false, null
									);
								};

						}
					);
				};


			AddButtonDummy(new RTA_save());

			ToolbarContainer.Add(new RTA_separator_horizontal());


			AddButton(new RTA_bold(), "Bold");
			AddButton(new RTA_underline(), "Underline");
			AddButton(new RTA_strikethrough(), "Strikethrough");
			AddButton(new RTA_italic(), "Italic");

			ToolbarContainer.Add(new RTA_separator_horizontal());

			AddButton(new RTA_justifyleft(), "JustifyLeft");
			AddButton(new RTA_justifycenter(), "JustifyCenter");
			AddButton(new RTA_justifyright(), "JustifyRight");
			AddButton(new RTA_justifyfull(), "JustifyFull");

			AddSection(
				"Editor with toolbar",
				Content
			);
		}
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:97,代码来源:Application.cs

示例5: Application

		/// <summary>
		/// This is a javascript application.
		/// </summary>
		/// <param name="page">HTML document rendered by the web server which can now be enhanced.</param>
		public Application(IDefaultPage page)
		{
			new JSCSolutionsNETImage().ToBackground(page.Item1.style, false);
			new JSCSolutionsNETImage().ToBackground(page.Item2.style, false);


			// Update document title
			// http://do.jsc-solutions.net/Update-document-title

			@"Hello world".ToDocumentTitle();
			// Send xml to server
			// http://do.jsc-solutions.net/Send-xml-to-server

			var v = new SolutionFileView();

			var f = new SolutionFile();

			f.WriteHTMLElement(StockPageDefault.Element);

			v.File = f;

			var Container = new IHTMLDiv();

			Container.style.position = IStyle.PositionEnum.relative;
			Container.style.display = IStyle.DisplayEnum.inline_block;
			Container.style.width = "600px";
			Container.style.height = "400px";
			Container.style.border = "1px solid gray";

			var ToolbarHeight = "1.3em";
			var Content = new IHTMLDiv().AttachTo(Container);

			Content.style.position = IStyle.PositionEnum.absolute;
			Content.style.left = "0px";
			Content.style.top = "0px";
			Content.style.right = "0px";
			Content.style.bottom = ToolbarHeight;


			var Toolbar = new IHTMLDiv().AttachTo(Container);

			Toolbar.style.backgroundColor = Color.FromGray(0xef);
			Toolbar.style.position = IStyle.PositionEnum.absolute;
			Toolbar.style.left = "0px";
			Toolbar.style.height = ToolbarHeight;
			Toolbar.style.right = "0px";
			Toolbar.style.bottom = "0px";

			Action<IHTMLImage, string, Action> AddToolbarButton =
				(img, text, handler) =>
				{
					var span = new IHTMLSpan { innerText = text };

					span.style.paddingLeft = "1.5em";
					span.style.paddingRight = "0.3em";

					var a = new IHTMLAnchor
					{
						img, span
					};

					img.style.verticalAlign = "middle";
					img.border = 0;
					img.style.position = IStyle.PositionEnum.absolute;

					a.style.backgroundColor = Color.FromGray(0xef);
					a.style.color = Color.Black;
					a.style.textDecoration = "none";
					a.style.fontFamily = IStyle.FontFamilyEnum.Tahoma;

					a.href = "javascript: void(0);";
					a.onclick +=
						delegate
						{
							handler();
						};
					a.style.display = IStyle.DisplayEnum.inline_block;
					a.style.height = "100%";


					a.onmousemove +=
						delegate
						{
							a.style.backgroundColor = Color.FromGray(0xff);
						};

					a.onmouseout +=
						delegate
						{
							a.style.backgroundColor = Color.FromGray(0xef);
						};

					Toolbar.Add(a);
				};


//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:Application.cs


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