我的程序中有两个网格列表控制窗口。我已成功禁用了水平滚动条但我无法删除水平滚动条。
我从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 :(得分:0)
从隐藏VScrollBar的示例中引用syncfusion,同样应该去HScrollBar。
如果要隐藏计划中网格中显示的滚动条, 您需要作为主机访问网格并禁用其滚动条 行为。请参阅以下code example and sample 参考
this.scheduleControl1.GetScheduleHost().HScrollBar.Enabled = false;
this.scheduleControl1.GetScheduleHost().HScrollBehavior =
Syncfusion.Windows.Forms.Grid.GridScrollbarMode.Disabled;
答案 1 :(得分: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;
请注意 禁用VScrollBehavior后,应将VScroll属性设置为false。