简体   繁体   中英

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

I have two grid list control window in my program.I have disabled the horizontal scroll bar successfully but I could not removed Horizontal Scroll bar.

I go through from Here: ,but did not cleared my concept.

Below is my part of code snippet:

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

How to remove Vertical Scroll bar from grid list control?

Kindly help?

quoting syncfusion from sample of hiding VScrollBar, same should go HScrollBar.

If you want to hide the scroll bar shown in grid inside the schedule, you need to access the grid as host and disable its scrollbar behavior. Please refer the below code example and sample for reference.

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

The Vertical scroll bar can be disabled by VScrollBehavior property. If theme for GridListControl is enabled, the vertical scroll bar can be disabled by setting VScroll property to false. Please make use of below code and sample,

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

Note VScroll property should be set to false after disabling the VScrollBehavior.

Screenshot

Sample

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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