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


C# System.AddAttribute方法代码示例

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


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

示例1: WriteHtml

    public override void WriteHtml(System.Web.UI.HtmlTextWriter w)
    {
      /*
      //set code language
      if (Language == CompiledQuestion.LANGUAGE.CPP)
      {
        LanguageToHighlight = HtmlHighlightedCode.LANGUAGE.Cpp;
      }
      else if (Language == CompiledQuestion.LANGUAGE.CS)
      {
        LanguageToHighlight = HtmlHighlightedCode.LANGUAGE.Cpp;
      }
      else if (Language == CompiledQuestion.LANGUAGE.Delphi)
      {
        LanguageToHighlight = HtmlHighlightedCode.LANGUAGE.Delphi;
      }
      else if (Language == CompiledQuestion.LANGUAGE.Java)
      {
        LanguageToHighlight = HtmlHighlightedCode.LANGUAGE.Java;
      }
       * */

      //<div>
      w.AddAttribute(HtmlAttribute.Id, Name);
      w.AddAttribute(HtmlAttribute.Name, "advancedCompiledTest");
      w.AddStyleAttribute(HtmlStyleAttribute.Position, "absolute");
      HtmlSerializeHelper<HtmlCompiledTest>.WriteRootElementAttributes(w, this);
      w.RenderBeginTag(HtmlTag.Div);

      //var ls = LanguageToHighlight.ToString().ToLower();

      //<span name="BeforeCode">//there will be lector code
      w.AddAttribute(HtmlAttribute.Id, "TextBoxBefore");
      w.AddStyleAttribute(HtmlStyleAttribute.Overflow, "scroll");
      w.AddStyleAttribute(HtmlStyleAttribute.Height, (Control as AdvancedCompiledTest).TextBoxBefore.Height.ToString());
      w.AddStyleAttribute(HtmlStyleAttribute.Width, (Control as AdvancedCompiledTest).TextBoxBefore.Width.ToString());
      w.RenderBeginTag(HtmlTag.Span);
      //w.AddAttribute(HtmlAttribute.Class, ls);
      //w.WriteFullBeginTag(string.Concat("pre><code class=\"", ls, "\""));
      w.WriteFullBeginTag(string.Concat("pre><code"));
      w.Write((Control as AdvancedCompiledTest).TextBoxBefore.Text.HttpEncode());
      w.WriteFullBeginTag("/code></pre");
      w.RenderEndTag();
      //</span>

      //<textarea>//there will be user code
      w.AddAttribute(HtmlAttribute.Id, "TextBoxUserCode");
      w.AddStyleAttribute(HtmlStyleAttribute.Width, (Control as AdvancedCompiledTest).TextBoxUserCode.Width.ToString());
      w.AddStyleAttribute(HtmlStyleAttribute.Height, (Control as AdvancedCompiledTest).TextBoxUserCode.Height.ToString());
      w.RenderBeginTag(HtmlTextWriterTag.Textarea);
      w.RenderEndTag();
      //</textarea>

      //<span name="AfterCode">//there will be lector code
      w.AddAttribute(HtmlAttribute.Id, "TextBoxAfter");
      w.AddStyleAttribute(HtmlStyleAttribute.Overflow, "scroll");
      w.AddStyleAttribute(HtmlStyleAttribute.Height, (Control as AdvancedCompiledTest).TextBoxAfter.Height.ToString());
      w.AddStyleAttribute(HtmlStyleAttribute.Width, (Control as AdvancedCompiledTest).TextBoxAfter.Width.ToString());
      w.RenderBeginTag(HtmlTag.Span);
      //w.AddAttribute(HtmlAttribute.Class, ls);
      //w.WriteFullBeginTag(string.Concat("pre><code class=\"", ls, "\""));
      w.WriteFullBeginTag(string.Concat("pre><code"));
      w.Write((Control as AdvancedCompiledTest).TextBoxAfter.Text.HttpEncode());
      w.WriteFullBeginTag("/code></pre");
      w.RenderEndTag();
      //</span>

      w.RenderEndTag();
      //</div>
    }
开发者ID:supermuk,项目名称:iudico,代码行数:70,代码来源:HtmlAdvanchedCompiledTest.cs


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