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


C# HtmlTextWriter.WriteStyleAttribute方法代码示例

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


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

示例1: RenderContents

 protected override void RenderContents(HtmlTextWriter output)
 {
     output.RenderBeginTag ("div");
     output.WriteStyleAttribute("height", Height.ToString());
     output.WriteStyleAttribute("height", Width.ToString());
     output.RenderEndTag();
 }
开发者ID:okyereadugyamfi,项目名称:softlogik,代码行数:7,代码来源:LoggedInAs.cs

示例2: RenderContents

 protected override void RenderContents(HtmlTextWriter output)
 {
     output.RenderBeginTag("img");
     output.WriteAttribute("src", Page.ClientScript.GetWebResourceUrl(GetType(), "SoftLogic.Web.Presentation.Controls.Resources.1pix.gif"));
     output.WriteStyleAttribute("height", Height.ToString());
     output.WriteStyleAttribute("height", Width.ToString());
     output.RenderEndTag();
 }
开发者ID:okyereadugyamfi,项目名称:softlogik,代码行数:8,代码来源:Spacer.cs

示例3: BuildAttribute

		protected override void BuildAttribute(HtmlTextWriter writer, string param, string content)
		{
			if(param != null)
			{
				string a = param.Trim().ToLower();

				if (a == "left" || a == "right" || a == "center")
				{
					writer.Write(" style=\"");
					writer.WriteStyleAttribute("text-align", param); //TODO:严格限定格式??
					writer.Write("\"");
				}
			}
		}
开发者ID:huchao007,项目名称:bbsmax,代码行数:14,代码来源:ALIGN.cs

示例4: BuildAttribute

		protected override void BuildAttribute(HtmlTextWriter writer, string param, string content)
		{
			writer.Write(" style=\"");
			writer.WriteStyleAttribute("color", param);
			writer.Write("\"");
		}
开发者ID:huchao007,项目名称:bbsmax,代码行数:6,代码来源:COLOR.cs

示例5: Render

        /// <summary>
        /// Render Contents
        /// </summary>
        /// <param name="writer">HtmlTextWriter to render to</param>
        protected override void Render(HtmlTextWriter writer)
        {
            // Render directly to the writer for performance reasons. This should also make the control
            // easier to port to pure client-side rendering if required

            // Scroll Table
            writer.WriteBeginTag(HtmlTextWriterTag.Table.ToString());
            writer.WriteAttribute("id", this.parentGrid.ClientID + "_scrollTable");
            writer.WriteAttribute("cellspacing", "0");
            writer.WriteAttribute("cellpadding", "0");
            writer.WriteAttribute("border", "0");            
            writer.WriteAttribute("class", "nhscui_mg_scroll_table");
            if (!this.DesignMode)
            {
                writer.Write("style=\"");
                writer.WriteStyleAttribute(HtmlTextWriterStyle.Visibility.ToString(), "hidden");
                writer.WriteStyleAttribute(HtmlTextWriterStyle.Width.ToString(), "100%");
                writer.Write(HtmlTextWriter.DoubleQuoteChar);
            }

            writer.Write(HtmlTextWriter.TagRightChar);

            // Header 
            writer.WriteFullBeginTag(HtmlTextWriterTag.Tr.ToString());
            writer.WriteFullBeginTag(HtmlTextWriterTag.Td.ToString());
            writer.WriteBeginTag(HtmlTextWriterTag.Div.ToString());
            writer.WriteAttribute("class", "nhscui_mg_header");            

            writer.Write("style=\"");
            writer.WriteStyleAttribute("width", this.ParentGrid.Width.ToString());
            writer.Write(HtmlTextWriter.DoubleQuoteChar);

            writer.Write(HtmlTextWriter.TagRightChar);

            writer.WriteBeginTag(HtmlTextWriterTag.Table.ToString());
            writer.WriteAttribute("id", "headerTable");
            writer.WriteAttribute("class", "nhscui_mg_header_table");
            writer.WriteAttribute("cellspacing", "0");
            writer.WriteAttribute("cellpadding", "0");            
            writer.WriteAttribute("border", "0");

            // Apply BorderCollapse override. This Style attribute will be removed client-side
            // This is to resolve an IE Issue where collapsed borders are not hidden on render
            writer.Write("style=\"");
            if (!string.IsNullOrEmpty(this.ParentGrid.Width.ToString()))
            {
                writer.WriteStyleAttribute("width", "100%");            
            }

            writer.WriteStyleAttribute("border-collapse", "separate");            
            writer.Write(HtmlTextWriter.DoubleQuoteChar);
            writer.Write(HtmlTextWriter.TagRightChar);

            writer.WriteFullBeginTag(HtmlTextWriterTag.Tr.ToString());

            // StartDate Column Header
            MedicationGridHeader.WriteColumnHeader(writer, "nhscui_mg_header_startdate", this.parentGrid.StartDateColumnWidth, this.parentGrid.StartDateColumnHeaderText, true, 1);

            // DrugDetails Column Header
            MedicationGridHeader.WriteColumnHeader(writer, "nhscui_mg_header_drugdetails", this.parentGrid.DrugDetailsColumnWidth, this.parentGrid.DrugDetailsColumnHeaderText, true, 3);

            // Reason Column Header
            MedicationGridHeader.WriteColumnHeader(writer, "nhscui_mg_header_reason", this.parentGrid.ReasonColumnWidth, this.parentGrid.ReasonColumnHeaderText, this.parentGrid.ShowReason, 1);

            // Status Column Header
            MedicationGridHeader.WriteColumnHeader(writer, "nhscui_mg_header_status", this.parentGrid.StatusColumnWidth, this.parentGrid.StatusColumnHeaderText, this.parentGrid.ShowStatus || this.parentGrid.ShowStatusDate, 1);

            // Header End Tags
            writer.WriteEndTag(HtmlTextWriterTag.Table.ToString());
            writer.WriteEndTag(HtmlTextWriterTag.Div.ToString());
            writer.WriteEndTag(HtmlTextWriterTag.Td.ToString());
            writer.WriteEndTag(HtmlTextWriterTag.Tr.ToString());
                        
            // Body
            writer.WriteFullBeginTag(HtmlTextWriterTag.Tr.ToString());
            writer.WriteFullBeginTag(HtmlTextWriterTag.Td.ToString());
            writer.WriteBeginTag(HtmlTextWriterTag.Div.ToString());
            writer.WriteAttribute("id", this.parentGrid.ClientID + "_bodyDiv");
            writer.WriteAttribute("class", "nhscui_mg_body");
            writer.Write(" style=\"");
            writer.WriteStyleAttribute("overflow-x", "hidden");

            // For initial rendering hide y overflow. This will be set where applicable in the behavior.
            writer.WriteStyleAttribute("overflow-y", "hidden");
            writer.WriteStyleAttribute(HtmlTextWriterStyle.Height.ToString(), "0");
            writer.Write(HtmlTextWriter.DoubleQuoteChar);
            writer.Write(HtmlTextWriter.TagRightChar);

            // Body Table
            writer.WriteBeginTag(HtmlTextWriterTag.Table.ToString());
            writer.WriteAttribute("id", this.parentGrid.ClientID + "_bodyTable");
            writer.WriteAttribute("cellspacing", "0");
            writer.WriteAttribute("cellpadding", "0");
            writer.WriteAttribute("class", "nhscui_mg_body_table");
            writer.WriteAttribute("border", "0");
            writer.WriteAttribute("onselectstart", "return false;");            
//.........这里部分代码省略.........
开发者ID:rbirkby,项目名称:mscui,代码行数:101,代码来源:MedicationGridHeader.cs

示例6: WriteColumnHeader

        /// <summary>
        /// Write a new Column Header
        /// </summary>
        /// <param name="writer">HtmlTextWriter to write to </param>        
        /// <param name="cssClass">CssClass</param>
        /// <param name="columnWidth">Column Width in Units</param>        
        /// <param name="headerText">Header text</param>
        /// <param name="display">Should the header be displayed</param>        
        /// <param name="columnSpan">Column Span</param>
        private static void WriteColumnHeader(HtmlTextWriter writer, string cssClass, Unit columnWidth, string headerText, bool display, int columnSpan)
        {
            // DrugDetails Column Header
            writer.WriteBeginTag(HtmlTextWriterTag.Th.ToString());
            if (columnSpan > 1)
            {
                writer.WriteAttribute("colspan", "3");
            }

            writer.WriteAttribute("class", cssClass);
            writer.WriteAttribute("nowrap", "nowrap");
            writer.Write(" style=\"");
            writer.WriteStyleAttribute(HtmlTextWriterStyle.Width.ToString(), columnWidth.ToString());

            if (!display)
            {
                writer.WriteStyleAttribute(HtmlTextWriterStyle.Display.ToString(), "none");
            }

            writer.Write(HtmlTextWriter.DoubleQuoteChar);
            writer.Write(HtmlTextWriter.TagRightChar);

            writer.WriteBeginTag(HtmlTextWriterTag.Div.ToString());
            writer.Write(" style=\"");
            writer.WriteStyleAttribute("white-space", "nowrap");
            writer.WriteStyleAttribute("word-break", "none");
            writer.Write(HtmlTextWriter.DoubleQuoteChar);
            writer.Write(HtmlTextWriter.TagRightChar);

            writer.Write(AntiXss.HtmlEncode(headerText));
            writer.WriteEndTag(HtmlTextWriterTag.Div.ToString());
            writer.WriteEndTag(HtmlTextWriterTag.Th.ToString());            
        }
开发者ID:rbirkby,项目名称:mscui,代码行数:42,代码来源:MedicationGridHeader.cs

示例7: BuildReport

        /// <summary>
        /// Build a HTML report of the results containing the calculated statistics and the data chart
        /// </summary>
        /// <param name="filename"><c>string</c> representing the full path to the Wireshark capture file</param>
        /// <returns><c>string</c> representing the report filename</returns>
        /// <remarks>Right now, the image is exported as the same size it appears in the main screen.</remarks>
        public string BuildReport(string filename)
        {
            // Export the image to the same directory as the capture file
            FileInfo capture_file = new FileInfo(filename);
            string dir = capture_file.DirectoryName;
            string name = capture_file.Name;
            string ext = capture_file.Extension;
            string basename = name.Remove(name.LastIndexOf(ext));
            string chart_filename = dir + "\\" + basename + ".png";
            _chart_main.SaveImage(chart_filename, ChartImageFormat.Png);

            // ----------------------------------------------------------------
            // Header for Report File
            // ----------------------------------------------------------------
            string html_filename = dir + "\\" + basename + ".html";
            StreamWriter writer = new StreamWriter(html_filename, false);
            HtmlTextWriter html_writer = new HtmlTextWriter(writer);
            html_writer.RenderBeginTag(HtmlTextWriterTag.Html);         // <html>
            html_writer.RenderBeginTag(HtmlTextWriterTag.Head);         // <head>
            html_writer.RenderBeginTag(HtmlTextWriterTag.Title);        // <title>
            html_writer.Write("IENetP Report - " + filename);
            html_writer.RenderEndTag();                                 // </title>

            // Stylesheet
            html_writer.RenderBeginTag(HtmlTextWriterTag.Style);        // <style>
            html_writer.Write("body { ");
            html_writer.WriteStyleAttribute("font-family", "Arial, Helvetica, sans-serif");
            html_writer.WriteLine(" }");
            html_writer.Write("h1 { ");
            html_writer.WriteStyleAttribute("font-weight", "bold");
            html_writer.WriteStyleAttribute("text-transform", "uppercase");
            html_writer.WriteStyleAttribute("text-align", "center");
            html_writer.WriteStyleAttribute("padding", "18px");
            html_writer.WriteStyleAttribute("border", "thick solid #FFFF99");
            html_writer.WriteStyleAttribute("background-color", "#004000");
            html_writer.WriteStyleAttribute("color", "#CCFFFF");
            html_writer.WriteLine(" }");
            html_writer.Write("h2 { ");
            html_writer.WriteStyleAttribute("font-weight", "bold");
            html_writer.WriteStyleAttribute("background-color", "#FFFF99");
            html_writer.WriteLine(" }");
            html_writer.Write("h3 { ");
            html_writer.WriteStyleAttribute("text-decoration", "underline");
            html_writer.WriteLine(" }");
            html_writer.Write("table.info { ");
            html_writer.WriteLine(" }");
            html_writer.Write("th.info { ");
            html_writer.WriteStyleAttribute("background-color", "#004000");
            html_writer.WriteStyleAttribute("color", "#EEFFEE");
            html_writer.WriteStyleAttribute("padding", "2px");
            html_writer.WriteStyleAttribute("width", "100px");
            html_writer.WriteLine(" }");
            html_writer.Write("td.info_description { ");
            html_writer.WriteStyleAttribute("background-color", "#E0F0E0");
            html_writer.WriteStyleAttribute("padding", "1px");
            html_writer.WriteLine(" }");
            html_writer.Write("td.info_value { ");
            html_writer.WriteStyleAttribute("background-color", "#E8F8E8");
            html_writer.WriteStyleAttribute("padding", "1px");
            html_writer.WriteLine(" }");
            html_writer.Write("table.results { ");
            html_writer.WriteLine(" }");
            html_writer.Write("th.results { ");
            html_writer.WriteStyleAttribute("background-color", "#000040");
            html_writer.WriteStyleAttribute("color", "#EEEEFF");
            html_writer.WriteStyleAttribute("padding", "2px");
            html_writer.WriteStyleAttribute("width", "100px");
            html_writer.WriteLine(" }");
            html_writer.Write("td.results_description { ");
            html_writer.WriteStyleAttribute("background-color", "#E8E8F8");
            html_writer.WriteStyleAttribute("padding", "1px");
            html_writer.WriteLine(" }");
            html_writer.Write("td.results_value { ");
            html_writer.WriteStyleAttribute("background-color", "#EEEEFF");
            html_writer.WriteStyleAttribute("padding", "1px");
            html_writer.WriteStyleAttribute("text-align", "center");
            html_writer.WriteLine(" }");
            html_writer.Write("p.log { ");
            html_writer.WriteStyleAttribute("font-family", "Courier New, monospace");
            html_writer.WriteLine(" }");
            html_writer.RenderEndTag();                                 // </style>

            html_writer.RenderEndTag();                                 // </head>
            html_writer.RenderBeginTag(HtmlTextWriterTag.Body);         // <body>

            html_writer.RenderBeginTag(HtmlTextWriterTag.H1);           // <h1>
            html_writer.Write("IENetP Test Tool Report");
            html_writer.RenderEndTag();                                 // </h1>
            html_writer.RenderBeginTag(HtmlTextWriterTag.P);            // <p>
            html_writer.Write("This report was automatically generated by the IENetP Test Tool.  For more information about the software, please visit the ");
            html_writer.AddAttribute(HtmlTextWriterAttribute.Href, "http://ienetp.sourceforge.net");
            html_writer.AddAttribute(HtmlTextWriterAttribute.Target, "_blank");
            html_writer.RenderBeginTag(HtmlTextWriterTag.A);
            html_writer.Write("IENetP SourceForge Page");
//.........这里部分代码省略.........
开发者ID:paperwork,项目名称:IENetP,代码行数:101,代码来源:Plotter.cs

示例8: Deny_Unrestricted

		private void Deny_Unrestricted (HtmlTextWriter htw)
		{
			Assert.IsTrue (htw.Indent >= 0, "Indent");
			Assert.AreSame (sw, htw.InnerWriter, "InnerWriter");
			htw.NewLine = Environment.NewLine;
			Assert.IsNotNull (htw.NewLine, "NewLine");

			htw.AddAttribute (HtmlTextWriterAttribute.Bgcolor, "blue");
			htw.AddAttribute (HtmlTextWriterAttribute.Bgcolor, "blue", false);
			htw.AddAttribute ("align", "left");
			htw.AddAttribute ("align", "left", false);

			htw.AddStyleAttribute (HtmlTextWriterStyle.BackgroundColor, "blue");
			htw.AddStyleAttribute ("left", "1");

			htw.RenderBeginTag (HtmlTextWriterTag.Table);
			htw.RenderBeginTag ("<tr>");
			htw.RenderEndTag ();

			htw.WriteAttribute ("align", "left");
			htw.WriteAttribute ("align", "left", false);
			htw.WriteBeginTag ("table");
			htw.WriteEndTag ("table");
			htw.WriteFullBeginTag ("div");

			htw.WriteStyleAttribute ("left", "2");
			htw.WriteStyleAttribute ("left", "3", false);

			htw.Write (new char[1], 0, 1);
			htw.Write ((double)1.0);
			htw.Write (Char.MinValue);
			htw.Write (new char[1]);
			htw.Write ((int)1);
			htw.Write ("{0}", 1);
			htw.Write ("{0}{1}", 1, 2);
			htw.Write ("{0}{1}{2}", 1, 2, 3);
			htw.Write (String.Empty);
			htw.Write ((long)1);
			htw.Write (this);
			htw.Write ((float)1.0);
			htw.Write (false);

			htw.WriteLine (new char[1], 0, 1);
			htw.WriteLine ((double)1.0);
			htw.WriteLine (Char.MinValue);
			htw.WriteLine (new char[1]);
			htw.WriteLine ((int)1);
			htw.WriteLine ("{0}", 1);
			htw.WriteLine ("{0}{1}", 1, 2);
			htw.WriteLine ("{0}{1}{2}", 1, 2, 3);
			htw.WriteLine (String.Empty);
			htw.WriteLine ((long)1);
			htw.WriteLine (this);
			htw.WriteLine ((float)1.0);
			htw.WriteLine (false);
			htw.WriteLine ((uint)0);
			htw.WriteLine ();
			htw.WriteLineNoTabs (String.Empty);

			htw.Flush ();
			htw.Close ();
		}
开发者ID:nobled,项目名称:mono,代码行数:62,代码来源:HtmlTextWriterCas.cs


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