国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

如何為CheckBoxList和RadioButtonList添加滾動條

2024-07-10 12:46:57
字體:
來源:轉載
供稿:網友

如何給CheckBoxList和RadioButtonList添加滾動條?
繼承基類CheckBoxList和RadioButtonList,添加滾動屬性,重寫Render方法即可。
屬性列表:

#region 滾動控制    private bool _ShowScrollBar = false;    /// <summary>    /// 顯示滾動條    /// </summary>    [    System.ComponentModel.Description("是否顯示顯示滾動條")    , System.ComponentModel.DefaultValue(false)    , System.ComponentModel.Category("滾動條設置")    , System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)    ]    public bool ShowScrollBar    {      get { return _ShowScrollBar; }      set { _ShowScrollBar = value; }    }    private Overflow _OverflowY = Overflow.auto;    /// <summary>    /// 豎直滾動條    /// </summary>    [    System.ComponentModel.Description("豎直滾動條")    , System.ComponentModel.DefaultValue(Overflow.auto)    , System.ComponentModel.Category("滾動條設置")    , System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)    ]    public Overflow OverflowY    {      get { return _OverflowY; }      set { _OverflowY = value; }    }    private Overflow _OverflowX = Overflow.auto;    /// <summary>    /// 水平滾動條    /// </summary>    [    System.ComponentModel.Description("水平滾動條")    , System.ComponentModel.DefaultValue(Overflow.auto)    , System.ComponentModel.Category("滾動條設置")    , System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)    ]    public Overflow OverflowX    {      get { return _OverflowX; }      set { _OverflowX = value; }    }    private Unit _ScrollHeight = Unit.Parse("0px");    /// <summary>    /// 滾動高度    /// </summary>    [    System.ComponentModel.Description("滾動高度")    , System.ComponentModel.Category("滾動條設置")     , DefaultValue("0px")    , System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)    ]    public Unit ScrollHeight    {      get { return _ScrollHeight; }      set { _ScrollHeight = value; }    }    private Unit _ScrollWidth = Unit.Parse("0px");    /// <summary>    /// 滾動寬度    /// </summary>    [    System.ComponentModel.Description("滾動寬度")    , System.ComponentModel.Category("滾動條設置")    , DefaultValue("0px")    , System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)    ]    public Unit ScrollWidth    {      get { return _ScrollWidth; }      set { _ScrollWidth = value; }    }    private string _ScrollCssClass = "";    /// <summary>    /// 滾動樣式設置    /// </summary>    [    System.ComponentModel.Description("滾動樣式設置")    , System.ComponentModel.Category("滾動條設置")    , System.ComponentModel.DefaultValue("")    , System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)    ]    public string ScrollCssClass    {      get { return _ScrollCssClass; }      set { _ScrollCssClass = value; }    }    #region 書寫標簽    void WriteBeginSpan(HtmlTextWriter writer)    {      if (this._ShowScrollBar)      {        StringBuilder strSpan = new StringBuilder();        strSpan.Append("<span ");        strSpan.Append(string.Format("style='overflow-y:{0};overflow-x:{1};",          System.Enum.GetName(typeof(Overflow), this._OverflowY),          System.Enum.GetName(typeof(Overflow), this._OverflowX)));        if (this._ScrollHeight.ToString() != "0px")        {          strSpan.Append(string.Format("height:{0};", this._ScrollHeight));        }        if (this._ScrollWidth.ToString() != "0px")        {          strSpan.Append(string.Format("width:{0};", this._ScrollWidth));        }        strSpan.Append("';");        if (!string.IsNullOrEmpty(_ScrollCssClass))        {          strSpan.Append(string.Format(" class='{0}'", _ScrollCssClass));        }        strSpan.Append(">");        writer.Write(strSpan.ToString());      }    }    void WriteEndSpan(HtmlTextWriter writer)    {      if (this._ShowScrollBar)      {        writer.Write("</span>");      }    }    #endregion    #endregion            
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 江华| 卢龙县| 江津市| 北海市| 鄂尔多斯市| 梁山县| 寻甸| 玉林市| 易门县| 盱眙县| 乳山市| 西丰县| 琼结县| 岳阳县| 方正县| 凤翔县| 巴东县| 介休市| 固安县| 益阳市| 班戈县| 鸡东县| 涪陵区| 防城港市| 磴口县| 赣榆县| 定州市| 虎林市| 绥江县| 新蔡县| 渭源县| 清水县| 弋阳县| 南澳县| 洛宁县| 海淀区| 江陵县| 蒙阴县| 栾城县| 马公市| 澄城县|