<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        如何為CheckBoxList和RadioButtonList添加滾動條

        來源:懂視網 責編:小采 時間:2020-11-27 22:36:55
        文檔

        如何為CheckBoxList和RadioButtonList添加滾動條

        如何為CheckBoxList和RadioButtonList添加滾動條:如何給CheckBoxList和RadioButtonList添加滾動條? 繼承基類CheckBoxList和RadioButtonList,添加滾動屬性,重寫Render方法即可。 屬性列表: #region 滾動控制 private bool _ShowScrollBar = false; /// <su
        推薦度:
        導讀如何為CheckBoxList和RadioButtonList添加滾動條:如何給CheckBoxList和RadioButtonList添加滾動條? 繼承基類CheckBoxList和RadioButtonList,添加滾動屬性,重寫Render方法即可。 屬性列表: #region 滾動控制 private bool _ShowScrollBar = false; /// <su

        如何給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
        

        重寫Render方法: 

         protected override void Render(HtmlTextWriter writer)
         {
         this.WriteBeginSpan(writer);
         base.Render(writer);
         this.WriteEndSpan(writer);
         } 
        
        

        就這樣就可以了。
        還要定義一個枚舉:

        public enum Overflow
         {
         auto = 0,
         hidden = 1,
         scroll = 2,
         visible = 3,
         inherit = 4
         }
        

        聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        如何為CheckBoxList和RadioButtonList添加滾動條

        如何為CheckBoxList和RadioButtonList添加滾動條:如何給CheckBoxList和RadioButtonList添加滾動條? 繼承基類CheckBoxList和RadioButtonList,添加滾動屬性,重寫Render方法即可。 屬性列表: #region 滾動控制 private bool _ShowScrollBar = false; /// <su
        推薦度:
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 国产成人无码区免费A∨视频网站| 亚洲综合一区二区精品导航 | 四虎精品亚洲一区二区三区| 99久久人妻精品免费二区| 日本精品久久久久久久久免费| 亚洲专区中文字幕| 亚洲精品狼友在线播放| 五月婷婷亚洲综合| 日韩免费高清视频网站| 无码国产精品一区二区免费式直播| 中文字幕免费在线视频| 美女又黄又免费的视频| 亚洲成AV人片在WWW| 亚洲小说图片视频| 亚洲精品在线播放视频| 亚洲成AV人片在线播放无码| 亚洲日本中文字幕天堂网| 四虎影视永久免费观看| 日本免费中文字幕在线看| 成年性羞羞视频免费观看无限| 亚洲免费观看在线视频| 最新黄色免费网站| 91大神在线免费观看| 日韩在线不卡免费视频一区| 爽爽爽爽爽爽爽成人免费观看| 一本到卡二卡三卡免费高 | 成年性午夜免费视频网站不卡| 7723日本高清完整版免费| 亚洲w码欧洲s码免费| 中文字幕在线免费观看| 67pao强力打造国产免费| h视频在线观看免费网站| 亚洲电影免费观看| 91香蕉成人免费网站| 中文字幕无码免费久久99| 亚洲第一成年免费网站| 大地资源在线观看免费高清| 欧美三级在线电影免费| 女人18毛片免费观看| 四虎永久在线精品视频免费观看| 国产又大又粗又硬又长免费|