[MLTR07754]編集中のセルの直前のセルの幅が狭いとき、セルの値の一部が表示されない場合がある
対象製品
MultiRow for Windows Forms 5.0J
発生環境
動作保証環境と同じ
詳細
文字列型セルで値を編集するとき、直前のセルの幅が編集するセルの幅よりも狭く、かつセルの値の自動選択を有効にしているとき、すべての値を表示できる十分なセル幅があるにもかかわらず、セルの値の一部が表示されません。(カーソルキーで左に移動すると完全に表示できます)
回避方法
編集用コントロールのサイズ変更に対応して選択範囲を再設定することでこの現象を回避できます。
[Visual Basic]
Imports GrapeCity.Win.MultiRow
Private Sub GcMultiRow1_EditingControlShowing(ByVal sender As Object, ByVal e As GrapeCity.Win.MultiRow.EditingControlShowingEventArgs) Handles GcMultiRow1.EditingControlShowing
RemoveHandler e.Control.SizeChanged, AddressOf Control_SizeChanged
AddHandler e.Control.SizeChanged, AddressOf Control_SizeChanged
End Sub
Private Sub Control_SizeChanged(ByVal sender As Object, ByVal e As EventArgs)
If TypeOf sender Is TextBoxEditingControl Then
Dim textBox As TextBox = DirectCast(sender, TextBox)
Dim selectionStart As Integer = textBox.SelectionStart
Dim selectionLength As Integer = textBox.SelectionLength
textBox.SelectionStart = 0
textBox.SelectionLength = 0
textBox.SelectionStart = selectionStart
textBox.SelectionLength = selectionLength
End If
End Sub
[C#]
using GrapeCity.Win.MultiRow;
private void gcMultiRow1_EditingControlShowing(object sender, GrapeCity.Win.MultiRow.EditingControlShowingEventArgs e)
{
e.Control.SizeChanged -= this.Control_SizeChanged;
e.Control.SizeChanged += this.Control_SizeChanged;
}
private void Control_SizeChanged(object sender, EventArgs e)
{
if (sender is TextBoxEditingControl)
{
TextBox textBox = sender as TextBox;
int selectionStart = textBox.SelectionStart;
int selectionLength = textBox.SelectionLength;
textBox.SelectionStart = 0;
textBox.SelectionLength = 0;
textBox.SelectionStart = selectionStart;
textBox.SelectionLength = selectionLength;
}
}
[Visual Basic]
Imports GrapeCity.Win.MultiRow
Private Sub GcMultiRow1_EditingControlShowing(ByVal sender As Object, ByVal e As GrapeCity.Win.MultiRow.EditingControlShowingEventArgs) Handles GcMultiRow1.EditingControlShowing
RemoveHandler e.Control.SizeChanged, AddressOf Control_SizeChanged
AddHandler e.Control.SizeChanged, AddressOf Control_SizeChanged
End Sub
Private Sub Control_SizeChanged(ByVal sender As Object, ByVal e As EventArgs)
If TypeOf sender Is TextBoxEditingControl Then
Dim textBox As TextBox = DirectCast(sender, TextBox)
Dim selectionStart As Integer = textBox.SelectionStart
Dim selectionLength As Integer = textBox.SelectionLength
textBox.SelectionStart = 0
textBox.SelectionLength = 0
textBox.SelectionStart = selectionStart
textBox.SelectionLength = selectionLength
End If
End Sub
[C#]
using GrapeCity.Win.MultiRow;
private void gcMultiRow1_EditingControlShowing(object sender, GrapeCity.Win.MultiRow.EditingControlShowingEventArgs e)
{
e.Control.SizeChanged -= this.Control_SizeChanged;
e.Control.SizeChanged += this.Control_SizeChanged;
}
private void Control_SizeChanged(object sender, EventArgs e)
{
if (sender is TextBoxEditingControl)
{
TextBox textBox = sender as TextBox;
int selectionStart = textBox.SelectionStart;
int selectionLength = textBox.SelectionLength;
textBox.SelectionStart = 0;
textBox.SelectionLength = 0;
textBox.SelectionStart = selectionStart;
textBox.SelectionLength = selectionLength;
}
}
この文書は、以前は次のFAQ IDで公開されていました : 8408