任何带有长字符串的东西都只会引入一个带有滚动条的不可用视图。
集合编辑器的宽度是否由设计固定,是否可以在这个很棒的演示文稿中引入拆分器?
任何带有长字符串的东西都只会引入一个带有滚动条的不可用视图。
集合编辑器的宽度是否由设计固定,是否可以在这个很棒的演示文稿中引入拆分器?
我还没有看到使用常规的方法来做到这一点,但如果你不介意付费,Visualhint 在这里PropertyGrid
有一个更发达的产品——也许可以试用一下。
这使用反射来完成工作;谨慎使用...
using System;
using System.Reflection;
using System.Windows.Forms;
class Program {
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Form form = new Form();
// this bar will control the splitter
ScrollBar sb = new HScrollBar {
Minimum = 10, Maximum = 200,
Dock = DockStyle.Bottom
};
// the grid we want to control
PropertyGrid grid = new PropertyGrid {
SelectedObject = form, Dock = DockStyle.Fill
};
// add to the form
form.Controls.Add(grid);
form.Controls.Add(sb);
// event to update the grid
sb.ValueChanged += delegate {
MoveSplitterTo(grid, sb.Value);
};
Application.Run(form);
}
static void MoveSplitterTo(PropertyGrid grid, int x) {
// HEALTH WARNING: reflection can be brittle...
FieldInfo field = typeof(PropertyGrid)
.GetField("gridView",
BindingFlags.NonPublic | BindingFlags.Instance);
field.FieldType
.GetMethod("MoveSplitterTo",
BindingFlags.NonPublic | BindingFlags.Instance)
.Invoke(field.GetValue(grid), new object[] { x });
}
}