2017-03-07 52 views
0

我在我的程序中有兩個網格列表控制窗口。我已經禁用了水平滾動條,但我無法刪除水平滾動條。如何從C Sharp中的網格列表控件中刪除/禁用垂直滾動條?

我從Here:經過,但沒有清除我的概念。

下面是我的代碼片段的一部分:

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; 
      } 
    } 

如何從網格列表控件中刪除垂直滾動條?

請幫忙嗎?

回答

0

從樣本隱藏VScrollBar引用syncfusion,同樣應該去HScrollBar。

如果你想隱藏在網格中所示的時間表內滾動條, 您需要訪問網格作爲主機,並禁用其滾動 行爲。請參考code example and sample以獲取 參考。

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

垂直滾動條可以通過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。

Screenshot

Sample