繁体   English   中英

如何在C Sharp中从网格列表控件中删除/禁用垂直滚动条?

[英]How to remove/disable vertical scroll bar from grid list control in C Sharp?

我的程序中有两个网格列表控制窗口。我已成功禁用水平滚动条,但无法删除水平滚动条。

我从这里经过 ,但并没有清除我的概念。

以下是我的部分代码片段:

  namespace First_Form_Demo
   {
     public partial class Form1 : Form
       {
          List<Tuple<int, int, double>> list_Tuple_BuySideDepth = null;
          List<Tuple<double, int, int>> list_Tuple_BuySideDepth1 = null;
          public Form1()
           {
               InitializeComponent();
               Init();
           }

          private void Init()
            {
// For GridListControl1.
        list_Tuple_BuySideDepth = new List<Tuple<int, int, double>>();
        list_Tuple_BuySideDepth.Add(new Tuple<int, int, double>(3, 451, 67.0050));
        list_Tuple_BuySideDepth.Add(new Tuple<int, int, double>(9, 655, 67.0025));
        list_Tuple_BuySideDepth.Add(new Tuple<int, int, double>(17, 2045, 67.0000));
        list_Tuple_BuySideDepth.Add(new Tuple<int, int, double>(22, 2080, 66.9875));
        list_Tuple_BuySideDepth.Add(new Tuple<int, int, double>(23, 1564, 66.9950));

// For GridListControl2.
        list_Tuple_BuySideDepth1 = new List<Tuple<double, int, int>>();
        list_Tuple_BuySideDepth1.Add(new Tuple<double, int, int>(67.0075, 813, 10));
        list_Tuple_BuySideDepth1.Add(new Tuple<double, int, int>(67.0100, 1255, 28));
        list_Tuple_BuySideDepth1.Add(new Tuple<double, int, int>(67.0125, 715, 13));
        list_Tuple_BuySideDepth1.Add(new Tuple<double, int, int>(67.0150, 1687, 19));
        list_Tuple_BuySideDepth1.Add(new Tuple<double, int, int>(67.0175, 1612, 24));
    }    
 }

  private void Form1_Load(object sender, EventArgs e)
    {        
       MaximizeBox = false;
       MinimizeBox = false;
       if (true)
          {
             gridListControl1.MultiColumn = true;
             gridListControl1.ForeColor = Color.Red;
             gridListControl1.DataSource = list_Tuple_BuySideDepth;
             this.gridListControl1.Grid.HScrollBehavior =        Syncfusion.Windows.Forms.Grid.GridScrollbarMode.Disabled;//GridScrollbarMode.Disabled;
             gridListControl2.MultiColumn = true;
             gridListControl2.ForeColor = Color.Red;
             gridListControl2.DataSource = list_Tuple_BuySideDepth;
             this.gridListControl2.Grid.HScrollBehavior = Syncfusion.Windows.Forms.Grid.GridScrollbarMode.Disabled;
          }
    }

如何从网格列表控件中删除垂直滚动条?

请帮忙?

引用隐藏的VScrollBar样本中的syncfusion,同样应该去HScrollBar。

如果要隐藏时间表中网格中显示的滚动条,则需要以主机身份访问网格并禁用其滚动条行为。 请参考下面的代码示例和示例以供参考。

 this.scheduleControl1.GetScheduleHost().HScrollBar.Enabled = false;
 this.scheduleControl1.GetScheduleHost().HScrollBehavior = 
        Syncfusion.Windows.Forms.Grid.GridScrollbarMode.Disabled;

垂直滚动条可以通过VScrollBehavior属性禁用。 如果启用了GridListControl的主题,则可以通过将VScroll属性设置为false来禁用垂直滚动条。 请使用以下代码和示例,

//To set theme for GridListControl
this.gridListControl1.GridVisualStyles = Syncfusion.Windows.Forms.GridVisualStyles.Metro;
//To disable the horizontal scroll bar
this.gridListControl1.Grid.HScrollBehavior = Syncfusion.Windows.Forms.Grid.GridScrollbarMode.Disabled;
//To disable the vertical scroll bar
this.gridListControl1.Grid.VScrollBehavior = Syncfusion.Windows.Forms.Grid.GridScrollbarMode.Disabled;
this.gridListControl1.Grid.VScroll = false;

注意在禁用VScrollBehavior之后,应将VScroll属性设置为false。

截图

样品

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM