MESCIUS SPREAD for Windows Forms 17.0J 移行ガイド
階層の展開/縮小でスクロール位置が再計算される


ステータス

バージョン ID 機能分類 対応策
8.0.3507.2008 80071 階層表示

詳細

階層の展開/縮小で、子階層の高さに応じてスクロール位置が再計算されます。これにより、階層の展開/縮小時に、子階層の高さに応じてスクロールバーのつまみ(Thumb)のサイズが変化します。また、つまみ(Thumb)がシートの最後に到達した状態で階層を縮小した場合、シートが上にスクロールします。

FpSpreadクラスのScrollBarMaxAlignプロパティをfalseに設定すると、スクロール位置は再計算されません。ただし、この設定により、スクロールバーは最終行(最終列)が表示領域の上端(左端)に表示されるまでスクロール可能となります。そのため、スクロールバーの最終スクロール位置がシートの最終行(最終列)と揃わなくなります。

private void Form1_Load(object sender, EventArgs e)
{
    set_childview();
    fpSpread1.Height = 300;
    //最終行(最終列)はシート上端(左端)までスクロール可能
    fpSpread1.ScrollBarMaxAlign = false;
}
public void set_childview()
{
    DataSet ds = new System.Data.DataSet();
    DataTable name;
    DataTable city;
    DataTable cars;
    name = ds.Tables.Add("Customers");
    name.Columns.AddRange(new DataColumn[] {new DataColumn("LastName", typeof(string)), new DataColumn("FirstName", typeof(string)), new DataColumn("ID", typeof(Int32))});
    name.Rows.Add(new object[] { "Fielding", "William", 0 });
    name.Rows.Add(new object[] { "Williams", "Arthur", 1 });
    name.Rows.Add(new object[] { "Zuchini", "Theodore", 2 });
    name.Rows.Add(new object[] { "Vanessa", "Tran", 3 });
    name.Rows.Add(new object[] { "Whitney", "Tracey", 4 });
    name.Rows.Add(new object[] { "Linda", "Nguyen", 5 });
    name.Rows.Add(new object[] { "Laurent", "Le", 6 });
    name.Rows.Add(new object[] { "John", "Pham", 7 });
    name.Rows.Add(new object[] { "Oliver", "Vu", 8 });
    city = ds.Tables.Add("City/State");
    city.Columns.AddRange(new DataColumn[] {new DataColumn("City", typeof(string)), new DataColumn("Owner", typeof(Int32)), new DataColumn("State", typeof(string))});
    city.Rows.Add(new object[] { "Atlanta", 0, "Georgia" });
    city.Rows.Add(new object[] { "NewYork", 0, "Georgia" });
    city.Rows.Add(new object[] { "California", 0, "Georgia" });
    city.Rows.Add(new object[] { "Boston", 1, "Mass." });
    city.Rows.Add(new object[] { "Backinh", 1, "Mass" });
    city.Rows.Add(new object[] { "ThuongHai", 3, "Mass" });
    city.Rows.Add(new object[] { "Tampa", 2, "Fla." });
    cars = ds.Tables.Add("Cars");
    cars.Columns.AddRange(new DataColumn[] { new DataColumn("Mark", Type.GetType("System.String")), new DataColumn("Owns", typeof(Int32)), new DataColumn("Model", Type.GetType("System.String")) });
    cars.Rows.Add(new Object[] { "Toyota", 0, "Vista" });
    cars.Rows.Add(new Object[] { "Subary", 1, "Forester" });
    cars.Rows.Add(new Object[] { "BMW", 2, "Passat" });
    ds.Relations.Add("City/State", name.Columns["ID"], city.Columns["Owner"]);
    fpSpread1.ActiveSheet.DataSource = ds;
    fpSpread1.ActiveSheet.DataMember = "Customers";
    fpSpread1.ActiveSheet.ExpandRow(-1, true);
}
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    set_childview()
    FpSpread1.Height = 300
    '最終行(最終列)はシート上端(左端)までスクロール可能
    FpSpread1.ScrollBarMaxAlign = False
End Sub
Public Sub set_childview()
    Dim ds As DataSet = New System.Data.DataSet()
    Dim name As DataTable
    Dim city As DataTable
    Dim cars As DataTable
    name = ds.Tables.Add("Customers")
    name.Columns.AddRange(New DataColumn() {New DataColumn("LastName", GetType(String)), New DataColumn("FirstName", GetType(String)), New DataColumn("ID", GetType(Int32))})
    name.Rows.Add(New Object() {"Fielding", "William", 0})
    name.Rows.Add(New Object() {"Williams", "Arthur", 1})
    name.Rows.Add(New Object() {"Zuchini", "Theodore", 2})
    name.Rows.Add(New Object() {"Vanessa", "Tran", 3})
    name.Rows.Add(New Object() {"Whitney", "Tracey", 4})
    name.Rows.Add(New Object() {"Linda", "Nguyen", 5})
    name.Rows.Add(New Object() {"Laurent", "Le", 6})
    name.Rows.Add(New Object() {"John", "Pham", 7})
    name.Rows.Add(New Object() {"Oliver", "Vu", 8})
    city = ds.Tables.Add("City/State")
    city.Columns.AddRange(New DataColumn() {New DataColumn("City", GetType(String)), New DataColumn("Owner", GetType(Int32)), New DataColumn("State", GetType(String))})
    city.Rows.Add(New Object() {"Atlanta", 0, "Georgia"})
    city.Rows.Add(New Object() {"NewYork", 0, "Georgia"})
    city.Rows.Add(New Object() {"California", 0, "Georgia"})
    city.Rows.Add(New Object() {"Boston", 1, "Mass."})
    city.Rows.Add(New Object() {"Backinh", 1, "Mass"})
    city.Rows.Add(New Object() {"ThuongHai", 3, "Mass"})
    city.Rows.Add(New Object() {"Tampa", 2, "Fla."})
    cars = ds.Tables.Add("Cars")
    cars.Columns.AddRange(New DataColumn() {New DataColumn("Mark", Type.[GetType]("System.String")), New DataColumn("Owns", GetType(Int32)), New DataColumn("Model", Type.[GetType]("System.String"))})
    cars.Rows.Add(New [Object]() {"Toyota", 0, "Vista"})
    cars.Rows.Add(New [Object]() {"Subary", 1, "Forester"})
    cars.Rows.Add(New [Object]() {"BMW", 2, "Passat"})
    ds.Relations.Add("City/State", name.Columns("ID"), city.Columns("Owner"))
    FpSpread1.ActiveSheet.DataSource = ds
    FpSpread1.ActiveSheet.DataMember = "Customers"
    FpSpread1.ActiveSheet.ExpandRow(-1, True)
End Sub
参照

 

 


© MESCIUS inc. All rights reserved.