FirstDisplayedCellPositionを使用したスクロール移動が動作しない場合がある
対象製品
MultiRow for Windows Forms 5.0J
状況
修正済み
詳細
FreezeLeftCellIndexプロパティまたはFreezeLeftCellNameプロパティで列を固定している場合、FirstDisplayedCellPositionに指定するCellIndexが固定列のCellIndexよりも小さい数値の場合、スクロールが移動しません。
回避方法
この現象はService Pack 2(v5.0.2011.0513)で修正されています。
最新のService Packのダウンロードはこちら 。
コードでCellIndexを変更し、固定列に指定するCellIndexをFirstDisplayedCellPositionに指定するCellIndexよりも小さい値にすることで回避することが可能です。
[Visual Basic]
Private Sub InitializeMultiRow()
' セルの設定
Dim textCell1 As New TextBoxCell()
textCell1.Name = "textCell1"
textCell1.Location = New Point(textCell1.Width, 0)
Dim textCell2 As New TextBoxCell()
textCell2.Name = "textCell2"
textCell2.Location = New Point(textCell1.Width * 2, 0)
Dim textCell3 As New TextBoxCell()
textCell3.Name = "textCell3"
textCell3.Location = New Point(textCell1.Width * 3, 0)
Dim textCell4 As New TextBoxCell()
textCell4.Name = "textCell4"
textCell4.Location = New Point(textCell1.Width * 4, 0)
Dim textCell5 As New TextBoxCell()
textCell5.Name = "textCell5"
textCell5.Location = New Point(0, 0)
' テンプレートの設定
Dim temp1 As New Template()
temp1.Width = textCell1.Width * 5
temp1.Row.Height = textCell1.Height
temp1.Row.Cells.AddRange(New Cell() {textCell1, textCell2, textCell3, textCell4, textCell5})
' 回避方法
' セルのインデックスを変更する
temp1.Row.Cells("textCell5").CellIndex = 0
temp1.Row.Cells("textCell1").CellIndex = 1
temp1.Row.Cells("textCell2").CellIndex = 2
temp1.Row.Cells("textCell3").CellIndex = 3
temp1.Row.Cells("textCell4").CellIndex = 4
' MultiRowの設定
GcMultiRow1.Template = temp1
GcMultiRow1.RowCount = 5
' 列を固定する
GcMultiRow1.FreezeLeftCellIndex = temp1.Row.Cells("textCell5").CellIndex
' スクロールの移動
GcMultiRow1.FirstDisplayedCellPosition = New CellPosition(0, 2)
End Sub
[C#]
private void InitializeMultiRow()
{
// セル型の設定
TextBoxCell textCell1 = new TextBoxCell();
textCell1.Name = "textCell1";
textCell1.Location = new Point(textCell1.Width, 0);
TextBoxCell textCell2 = new TextBoxCell();
textCell2.Name = "textCell2";
textCell2.Location = new Point(textCell1.Width * 2, 0);
TextBoxCell textCell3 = new TextBoxCell();
textCell3.Name = "textCell3";
textCell3.Location = new Point(textCell1.Width * 3, 0);
TextBoxCell textCell4 = new TextBoxCell();
textCell4.Name = "textCell4";
textCell4.Location = new Point(textCell1.Width * 4, 0);
TextBoxCell textCell5 = new TextBoxCell();
textCell5.Name = "textCell5";
textCell5.Location = new Point(0, 0);
// テンプレートの設定
Template temp1 = new Template();
temp1.Width = textCell1.Width * 5;
temp1.Row.Height = textCell1.Height;
temp1.Row.Cells.AddRange(new Cell[] { textCell1, textCell2, textCell3, textCell4, textCell5 });
// 回避方法
// セルのインデックスを変更する
temp1.Row.Cells["textCell5"].CellIndex = 0;
temp1.Row.Cells["textCell1"].CellIndex = 1;
temp1.Row.Cells["textCell2"].CellIndex = 2;
temp1.Row.Cells["textCell3"].CellIndex = 3;
temp1.Row.Cells["textCell4"].CellIndex = 4;
// MultiRowの設定
gcMultiRow1.Template = temp1;
gcMultiRow1.RowCount = 5;
// 列を固定する
gcMultiRow1.FreezeLeftCellIndex = temp1.Row.Cells["textCell5"].CellIndex;
// スクロールの移動
gcMultiRow1.FirstDisplayedCellPosition = new CellPosition(0, 2);
}
最新のService Packのダウンロードはこちら 。
コードでCellIndexを変更し、固定列に指定するCellIndexをFirstDisplayedCellPositionに指定するCellIndexよりも小さい値にすることで回避することが可能です。
[Visual Basic]
Private Sub InitializeMultiRow()
' セルの設定
Dim textCell1 As New TextBoxCell()
textCell1.Name = "textCell1"
textCell1.Location = New Point(textCell1.Width, 0)
Dim textCell2 As New TextBoxCell()
textCell2.Name = "textCell2"
textCell2.Location = New Point(textCell1.Width * 2, 0)
Dim textCell3 As New TextBoxCell()
textCell3.Name = "textCell3"
textCell3.Location = New Point(textCell1.Width * 3, 0)
Dim textCell4 As New TextBoxCell()
textCell4.Name = "textCell4"
textCell4.Location = New Point(textCell1.Width * 4, 0)
Dim textCell5 As New TextBoxCell()
textCell5.Name = "textCell5"
textCell5.Location = New Point(0, 0)
' テンプレートの設定
Dim temp1 As New Template()
temp1.Width = textCell1.Width * 5
temp1.Row.Height = textCell1.Height
temp1.Row.Cells.AddRange(New Cell() {textCell1, textCell2, textCell3, textCell4, textCell5})
' 回避方法
' セルのインデックスを変更する
temp1.Row.Cells("textCell5").CellIndex = 0
temp1.Row.Cells("textCell1").CellIndex = 1
temp1.Row.Cells("textCell2").CellIndex = 2
temp1.Row.Cells("textCell3").CellIndex = 3
temp1.Row.Cells("textCell4").CellIndex = 4
' MultiRowの設定
GcMultiRow1.Template = temp1
GcMultiRow1.RowCount = 5
' 列を固定する
GcMultiRow1.FreezeLeftCellIndex = temp1.Row.Cells("textCell5").CellIndex
' スクロールの移動
GcMultiRow1.FirstDisplayedCellPosition = New CellPosition(0, 2)
End Sub
[C#]
private void InitializeMultiRow()
{
// セル型の設定
TextBoxCell textCell1 = new TextBoxCell();
textCell1.Name = "textCell1";
textCell1.Location = new Point(textCell1.Width, 0);
TextBoxCell textCell2 = new TextBoxCell();
textCell2.Name = "textCell2";
textCell2.Location = new Point(textCell1.Width * 2, 0);
TextBoxCell textCell3 = new TextBoxCell();
textCell3.Name = "textCell3";
textCell3.Location = new Point(textCell1.Width * 3, 0);
TextBoxCell textCell4 = new TextBoxCell();
textCell4.Name = "textCell4";
textCell4.Location = new Point(textCell1.Width * 4, 0);
TextBoxCell textCell5 = new TextBoxCell();
textCell5.Name = "textCell5";
textCell5.Location = new Point(0, 0);
// テンプレートの設定
Template temp1 = new Template();
temp1.Width = textCell1.Width * 5;
temp1.Row.Height = textCell1.Height;
temp1.Row.Cells.AddRange(new Cell[] { textCell1, textCell2, textCell3, textCell4, textCell5 });
// 回避方法
// セルのインデックスを変更する
temp1.Row.Cells["textCell5"].CellIndex = 0;
temp1.Row.Cells["textCell1"].CellIndex = 1;
temp1.Row.Cells["textCell2"].CellIndex = 2;
temp1.Row.Cells["textCell3"].CellIndex = 3;
temp1.Row.Cells["textCell4"].CellIndex = 4;
// MultiRowの設定
gcMultiRow1.Template = temp1;
gcMultiRow1.RowCount = 5;
// 列を固定する
gcMultiRow1.FreezeLeftCellIndex = temp1.Row.Cells["textCell5"].CellIndex;
// スクロールの移動
gcMultiRow1.FirstDisplayedCellPosition = new CellPosition(0, 2);
}
キーワード
MLTR08035