本文整理汇总了C#中HtmlTextWriterStyle类的典型用法代码示例。如果您正苦于以下问题:C# HtmlTextWriterStyle类的具体用法?C# HtmlTextWriterStyle怎么用?C# HtmlTextWriterStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
HtmlTextWriterStyle类属于命名空间,在下文中一共展示了HtmlTextWriterStyle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AddStyleAttribute
protected override void AddStyleAttribute (string name, string value, HtmlTextWriterStyle key)
{
output.WriteLine ("{0:###0} AddStyleAttribute ({1}, {2}, {3}))", NextIndex (), name, value, key);
if (full_trace)
WriteTrace (new StackTrace ());
base.AddStyleAttribute (name, value, key);
}
示例2: OnStyleAttributeRender
protected override bool OnStyleAttributeRender(string name, string value, HtmlTextWriterStyle key)
{
if ((key == HtmlTextWriterStyle.TextDecoration) && StringUtil.EqualsIgnoreCase("line-through", value))
{
return false;
}
return base.OnStyleAttributeRender(name, value, key);
}
示例3: RegisterStyle
public NamedCssStyleCollection RegisterStyle (HtmlTextWriterStyle key, string value, string styleName = null)
{
if (styleName == null)
styleName = String.Empty;
NamedCssStyleCollection style = GetStyle (styleName);
style.Add (key, value);
return style;
}
示例4: StyleConversion
public string this[HtmlTextWriterStyle style]
{
get
{
return this[new StyleConversion(style).CssStyleName];
}
set
{
this[new StyleConversion(style).CssStyleName] = value;
}
}
示例5: Add
public void Add(HtmlTextWriterStyle key, string value)
{
if (this._intTable == null)
{
this._intTable = new HybridDictionary();
}
this._intTable[(int) key] = value;
string styleName = CssTextWriter.GetStyleName(key);
if (styleName.Length != 0)
{
if (this._table == null)
{
this.ParseString();
}
this._table.Remove(styleName);
}
if (this._state != null)
{
this._state["style"] = this.BuildString();
}
this._style = null;
}
示例6: OnStyleAttributeRender
/// <devdoc>
/// <para>[To be supplied.]</para>
/// </devdoc>
protected override bool OnStyleAttributeRender(string name,string value, HtmlTextWriterStyle key) {
string s;
if (Supports(FONT_AROUND_CONTENT)) {
// tag supports downlevel fonts
switch (key) {
case HtmlTextWriterStyle.FontFamily:
_fontFace = value;
_renderFontTag = true;
break;
case HtmlTextWriterStyle.Color:
_fontColor = value;
_renderFontTag = true;
break;
case HtmlTextWriterStyle.FontSize:
_fontSize = ConvertToHtmlFontSize(value);
if (_fontSize != null)
_renderFontTag = true;
break;
case HtmlTextWriterStyle.FontWeight:
if (StringUtil.EqualsIgnoreCase(value, "bold") && SupportsBold) {
AppendOtherTag("b");
}
break;
case HtmlTextWriterStyle.FontStyle:
if (!StringUtil.EqualsIgnoreCase(value, "normal") && SupportsItalic) {
AppendOtherTag("i");
}
break;
case HtmlTextWriterStyle.TextDecoration:
s = value.ToLower(CultureInfo.InvariantCulture);
if (s.IndexOf("underline", StringComparison.Ordinal) != -1) {
AppendOtherTag("u");
}
if (s.IndexOf("line-through", StringComparison.Ordinal) != -1) {
AppendOtherTag("strike");
}
break;
}
}
else if (Supports(FONT_PROPAGATE)) {
FontStackItem font = (FontStackItem)FontStack.Peek();
switch (key) {
case HtmlTextWriterStyle.FontFamily:
font.name = value;
break;
case HtmlTextWriterStyle.Color:
font.color = value;
break;
case HtmlTextWriterStyle.FontSize:
font.size = ConvertToHtmlFontSize(value);
break;
case HtmlTextWriterStyle.FontWeight:
if (StringUtil.EqualsIgnoreCase(value, "bold")) {
font.bold = true;
}
break;
case HtmlTextWriterStyle.FontStyle:
if (!StringUtil.EqualsIgnoreCase(value, "normal")) {
font.italic = true;
}
break;
case HtmlTextWriterStyle.TextDecoration:
s = value.ToLower(CultureInfo.InvariantCulture);
if (s.IndexOf("underline", StringComparison.Ordinal) != -1) {
font.underline = true;
}
if (s.IndexOf("line-through", StringComparison.Ordinal) != -1) {
font.strikeout = true;
}
break;
}
}
if (Supports(SUPPORTS_BORDER) && key == HtmlTextWriterStyle.BorderWidth) {
s = ConvertToHtmlSize(value);
if (s != null)
AddAttribute(HtmlTextWriterAttribute.Border,s);
}
if (Supports(SUPPORTS_NOWRAP) && key == HtmlTextWriterStyle.WhiteSpace) {
AddAttribute(HtmlTextWriterAttribute.Nowrap, value);
}
if (Supports(SUPPORTS_HEIGHT_WIDTH)) {
switch (key) {
case HtmlTextWriterStyle.Height :
s = ConvertToHtmlSize(value);
if (s != null)
AddAttribute(HtmlTextWriterAttribute.Height,s);
break;
case HtmlTextWriterStyle.Width :
s = ConvertToHtmlSize(value);
if (s != null)
AddAttribute(HtmlTextWriterAttribute.Width,s);
break;
//.........这里部分代码省略.........
示例7: Style
public HtmlAttributeManager Style(HtmlTextWriterStyle key, string value)
{
Writer.AddStyleAttribute(key, value);
return this;
}
示例8: WriteAttribute
/// <devdoc>
/// Render out the specified style attribute and value.
/// </devdoc>
public void WriteAttribute(HtmlTextWriterStyle key, string value) {
WriteAttribute(_writer, key, GetStyleName(key), value);
}
示例9: RegisterAttribute
/// <internalonly/>
/// <devdoc>
/// Registers the specified style attribute to create a mapping between a string representation
/// and the corresponding HtmlTextWriterStyle value.
/// </devdoc>
internal static void RegisterAttribute(string name, HtmlTextWriterStyle key, bool encode) {
RegisterAttribute(name, key, encode, false);
}
示例10: GetStyleName
/// <devdoc>
/// Returns the name of the attribute corresponding to the specified HtmlTextWriterStyle value.
/// </devdoc>
public static string GetStyleName(HtmlTextWriterStyle styleKey) {
if ((int)styleKey >= 0 && (int)styleKey < attrNameLookupArray.Length) {
return attrNameLookupArray[(int)styleKey].name;
}
return String.Empty;
}
示例11: StyleAttribute
public StyleAttribute(HtmlTextWriterStyle style, string value)
{
Value = value;
StyleString = StyleToString(style);
}
示例12: Add
public void Add (HtmlTextWriterStyle key, string value)
{
}
示例13: return
/// <devdoc>
/// Gets or sets the specified known CSS value.
/// </devdoc>
public string this[HtmlTextWriterStyle key] {
get {
if (_intTable == null) {
return null;
}
return (string)_intTable[(int)key];
}
set {
Add(key, value);
}
}
示例14: Remove
public void Remove(HtmlTextWriterStyle key) {
if (_intTable == null) {
return;
}
_intTable.Remove((int)key);
if (_state != null) {
// keep style attribute synchronized
_state["style"] = BuildString();
}
_style = null;
}
示例15: Add
public void Add(HtmlTextWriterStyle key, string value) {
if (_intTable == null) {
_intTable = new HybridDictionary();
}
_intTable[(int)key] = value;
string name = CssTextWriter.GetStyleName(key);
if (name.Length != 0) {
// Remove from the other table to avoid duplicates.
if (_table == null)
ParseString();
_table.Remove(name);
}
if (_state != null) {
// keep style attribute synchronized
_state["style"] = BuildString();
}
_style = null;
}