作成日: 2025/04/18 最終更新日: 2025/04/18
文書種別
不具合
状況
回避方法あり
詳細
"Windows 10 Version 2004 "以降に搭載されている Microsoft IME を日本語入力として選択した状態で、以下の操作をすると不正なフォーカスの移動が発生します。
(1) 日付型セルのドロップダウンカレンダー上で日付を選択すると、ドロップダウンカレンダーが閉じた後に左側のセルへフォーカスが移動する。
(2) 日付型セルを編集状態にして直接日付を変更し編集を終了すると、左下のセルへフォーカスが移動する。
※C1FlexGrid.KeyActionEnterプロパティを「MoveDown」に設定している場合に発生します。
「MoveAcross」に設定している場合は、右側のセルに移動せずそのセルに留まったままになります。
(1) 日付型セルのドロップダウンカレンダー上で日付を選択すると、ドロップダウンカレンダーが閉じた後に左側のセルへフォーカスが移動する。
(2) 日付型セルを編集状態にして直接日付を変更し編集を終了すると、左下のセルへフォーカスが移動する。
※C1FlexGrid.KeyActionEnterプロパティを「MoveDown」に設定している場合に発生します。
「MoveAcross」に設定している場合は、右側のセルに移動せずそのセルに留まったままになります。
回避方法
以下の方法で回避が可能です。
(1)IMEの変更
(A) 設定画面から、「以前のバージョンのIME を使用する」を有効にする
※Windowsの「設定」の「時刻と言語」で「以前のバージョンの Microsoft IME を使う」を オンに設定します。
(B) 他社製のIMEを日本語入力として選択する
(2)セル移動のキャンセル
Microsoft IMEを引き続き使用する場合、日付型セルの編集時イベントで該当列からのフォーカス移動をキャンセルします。
※BeforeRowColChangeイベントでe.Cancel = True と設定します。
◎サンプルコード(VB)
(1)IMEの変更
(A) 設定画面から、「以前のバージョンのIME を使用する」を有効にする
※Windowsの「設定」の「時刻と言語」で「以前のバージョンの Microsoft IME を使う」を オンに設定します。
(B) 他社製のIMEを日本語入力として選択する
(2)セル移動のキャンセル
Microsoft IMEを引き続き使用する場合、日付型セルの編集時イベントで該当列からのフォーカス移動をキャンセルします。
※BeforeRowColChangeイベントでe.Cancel = True と設定します。
◎サンプルコード(VB)
Imports C1.Win.C1FlexGrid
Public Class Form1
Private bClosed As Boolean = False
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
With C1FlexGrid1
.Cols(2).DataType = GetType(DateTime)
.Cols(2).Format = "D"
.Cols(2).Width = 120
.SetData(1, 2, DateTime.Today)
.KeyActionEnter = KeyActionEnum.MoveDown
End With
End Sub
Private Sub C1FlexGrid1_SetupEditor(sender As Object, e As RowColEventArgs) Handles C1FlexGrid1.SetupEditor
If e.Col = 2 Then
Dim editor = DirectCast(C1FlexGrid1.Editor, DateTimePicker)
RemoveHandler editor.CloseUp, AddressOf editor_CloseUp
AddHandler editor.CloseUp, AddressOf editor_CloseUp
End If
End Sub
Private Sub editor_CloseUp(sender As Object, e As EventArgs)
bClosed = True
End Sub
Private Sub C1FlexGrid1_BeforeRowColChange(sender As Object, e As RangeEventArgs) Handles C1FlexGrid1.BeforeRowColChange
If bClosed Or e.OldRange.LeftCol = 2 Then
e.Cancel = True
bClosed = False
End If
End Sub
End Class
◎サンプルコード(C#)
using C1.Win.C1FlexGrid;
namespace prj_C1FlexGrid
{
public partial class Form1 : Form
{
private bool bClosed = false;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
c1FlexGrid1.Cols[2].DataType = typeof(DateTime);
c1FlexGrid1.Cols[2].Format = "D";
c1FlexGrid1.Cols[2].Width = 120;
c1FlexGrid1.SetData(1, 2, DateTime.Today);
c1FlexGrid1.KeyActionEnter = KeyActionEnum.MoveDown;
}
private void c1FlexGrid1_SetupEditor(object sender, RowColEventArgs e)
{
if (e.Col == 2)
{
DateTimePicker editor = (DateTimePicker)c1FlexGrid1.Editor;
editor.CloseUp -= editor_CloseUp;
editor.CloseUp += editor_CloseUp;
}
}
private void editor_CloseUp(object sender, EventArgs e)
{
bClosed = true;
}
private void c1FlexGrid1_BeforeRowColChange(object sender, C1.Win.C1FlexGrid.RangeEventArgs e)
{
if (bClosed || e.OldRange.LeftCol == 2)
{
e.Cancel = true;
bClosed = false;
}
}
}
}