简体   繁体   English

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

[英]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. 引用隐藏的VScrollBar样本中的syncfusion,同样应该去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. 垂直滚动条可以通过VScrollBehavior属性禁用。 If theme for GridListControl is enabled, the vertical scroll bar can be disabled by setting VScroll property to false. 如果启用了GridListControl的主题,则可以通过将VScroll属性设置为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. 注意在禁用VScrollBehavior之后,应将VScroll属性设置为false。

Screenshot 截图

Sample 样品

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

相关问题 如何从C Sharp中的DataGridView中删除垂直和水平滚动条? - How to remove Vertical and Horizontal scroll bar from DataGridView in C sharp? 如何检测Grid Control垂直滚动条是可见还是隐藏。 开发快递 - How to Detect if Grid Control vertical scroll bar is visible or Hidden. Dev express 垂直滚动条不在WPF中的列表视图的网格内查看 - Vertical scroll bar is not viewing inside a grid for a list view in WPF 如何在详细信息模式下隐藏 .NET ListView 控件中的垂直滚动条 - How to hide the vertical scroll bar in a .NET ListView Control in Details mode 如何在C Sharp中单击另一个组合框列表数据时禁用组合框? - How to disable a combobox on clicking on another combox list data in C sharp? 如何从 C# 中的全屏控制台中删除滚动条? - How to remove scroll bar from fullscreen Console in C#? 无论垂直滚动条效果如何,控件的位置 - Location of a control regardless of Vertical scroll bar effect 在ListBox控件中隐藏垂直滚动条 - Hide vertical scroll bar in ListBox control 如何在ASP下拉列表中添加垂直滚动条? - How do i add vertical scroll bar in asp Dropdown list? 如果控件大小小于列表框大小,则无法禁用垂直滚动查看器 - Can't disable vertical scroll viewer if control size less than list box size
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM