XtraEditors.CheckedListBoxControl 或CheckedListBox 控件中显示水平滚动条

设置: checkedListBox1.HorizontalScrollbar=true;

DevExpress.XtraEditors.CheckedListBoxControl 因为控件属性中一直找不到该属性需要在代代码中手工添加.(这也是我贴出来的原因,呜呜,找这个属性耗了我不少时间)

    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            DisplayHScroll();
        }
        /// <summary>
        /// 获取或设置一个值,该值指示是否在控件中显示水平滚动条
        /// </summary>
        private void DisplayHScroll()
        {
            checkedListBox1.IntegralHeight = true;
            for (int x = 0; x < 10; x++)
            {
                checkedListBox1.Items.Add("Item  " + x.ToString() + " is a very large value that requires scroll bars");
            }
            checkedListBox1.HorizontalScrollbar=true;
        }
    }

运行结果如下图:

参考: http://msdn.microsoft.com/zh-cn/library/system.windows.forms.checkedlistbox.aspx

参考:http://msdn.microsoft.com/zh-cn/library/system.windows.forms.listbox.horizontalscrollbar.aspx

posted @ 2013-03-20 15:34  乡香田甜  阅读(1561)  评论(0编辑  收藏  举报