如何从C夏普中的网格列表控制中删除/禁用垂直滚动条



我的程序中有两个网格列表控制窗口。

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

下面是我的代码段的一部分:

  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样本的同步升级,相同的是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;

注意vsCroll属性应在禁用VSCrollBehavior之后将其设置为false。

屏幕截图

样本

最新更新