本文整理汇总了C#中System.Web.UI.ChtmlTextWriter.ChtmlTextWriter构造函数的典型用法代码示例。如果您正苦于以下问题:C# ChtmlTextWriter构造函数的具体用法?C# ChtmlTextWriter怎么用?C# ChtmlTextWriter使用的例子?那么恭喜您, 这里精选的构造函数代码示例或许可以为您提供帮助。您也可以进一步了解该构造函数所在类System.Web.UI.ChtmlTextWriter
的用法示例。
在下文中一共展示了ChtmlTextWriter构造函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCustomChtmlTextWriter
// Derive from the WebControlAdapter class,
// provide a CreateCustomChtmlTextWriter
// method to attach to the custom writer.
public class ChtmlCustomPageAdapter : WebControlAdapter
{
protected internal ChtmlTextWriter CreateCustomChtmlTextWriter(
TextWriter writer)
{
return new CustomChtmlTextWriter(writer);
}
}
示例2: CustomChtmlTextWriter
// Create a class that derives from the
// ChtmlTextWriter class.
using System;
using System.IO;
using System.Web.UI;
using System.Web.UI.WebControls.Adapters;
namespace AspNet.Samples.CS
{
public class CustomChtmlTextWriter : ChtmlTextWriter
{
// Create two constructors for the new
// text writer.
public CustomChtmlTextWriter(TextWriter writer) : base(writer, DefaultTabString)
{
}
public CustomChtmlTextWriter(TextWriter writer, String tabString)
: base(writer, tabString)
{
}
// Override the OnAttributeRender method to
// not render the bgcolor attribute, which is
// not supported in CHTML.
protected override bool OnAttributeRender(string name, string value, HtmlTextWriterAttribute key)
{
if (String.Equals("bgcolor", name))
{
return false;
}
// Call the ChtmlTextWriter version of the
// the OnAttributeRender method.
return base.OnAttributeRender(name, value, key);
}
}
// Derive from the WebControlAdapter class,
// provide a CreateCustomChtmlTextWriter
// method to attach to the custom writer.
public class ChtmlCustomPageAdapter : WebControlAdapter
{
protected internal ChtmlTextWriter CreateCustomChtmlTextWriter(
TextWriter writer)
{
return new CustomChtmlTextWriter(writer);
}
}
}