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