質問

長い文字列を持つものは、単にスクロールバーで使用できないビューを紹介し..

コレクションエディタ上の幅は、設計によって固定されており、この素晴らしいプレゼンテーションにスプリッタを導入することができますか?

役に立ちましたか?

解決

私は定期的にPropertyGridでこれを行う方法を見ていない、しかし、あなたが払って気にしない場合は、Visualhintははるかに先進募集<のhref = "http://www.visualhint.com/indexを持っています。ここをPHP / PropertyGridの/」のrel = "nofollowをnoreferrer"> - おそらく裁判それ

。 <時間>

これは、リフレクションを使って仕事をしていません。注意して使用して...

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 });
    }
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top