GcShapeButtonでスペースキーを押下するとClickイベントが2回発生する
対象製品
PlusPak for Windows Forms 8.0J
状況
修正済み
詳細
シェイプボタンコントロールにフォーカスが当たっている状態でスペースキーを押下すると、Clickイベントが2回発生してしまいます(キーの押下時に1回と離した時に1回)。
回避方法
この問題はService Pack 3(v8.0.2017.1121)で修正されました。
不具合を修正した最新のサービスパックは、アップデートページ からダウンロードできます。
Service Pack 3より前のバージョンでは次の方法で回避可能です。
シェイプボタンコントロールのAutoRepeatがTrueに設定されている時には現象が発生しませんので、次のようにPreviewKeyDownイベント内でAutoRepeatの値を切り替える方法で回避することが可能です。
[Visual Basic]
Private Sub gcShapeButton1_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs)
If e.KeyValue = 32 Then
DirectCast(sender, GrapeCity.Win.Buttons.GcShapeButton).AutoRepeat = True
End If
End Sub
Private Sub GcShapeButton1_KeyUp(sender As Object, e As KeyEventArgs)
If e.KeyValue = 32 Then
DirectCast(sender, GrapeCity.Win.Buttons.GcShapeButton).AutoRepeat = False
End If
End Sub
[C#]
private void gcShapeButton1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyValue == 32)
{
((GrapeCity.Win.Buttons.GcShapeButton)sender).AutoRepeat = true;
}
}
private void gcShapeButton1_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyValue == 32)
{
((GrapeCity.Win.Buttons.GcShapeButton)sender).AutoRepeat = false;
}
}
不具合を修正した最新のサービスパックは、アップデートページ からダウンロードできます。
Service Pack 3より前のバージョンでは次の方法で回避可能です。
シェイプボタンコントロールのAutoRepeatがTrueに設定されている時には現象が発生しませんので、次のようにPreviewKeyDownイベント内でAutoRepeatの値を切り替える方法で回避することが可能です。
[Visual Basic]
Private Sub gcShapeButton1_PreviewKeyDown(sender As Object, e As PreviewKeyDownEventArgs)
If e.KeyValue = 32 Then
DirectCast(sender, GrapeCity.Win.Buttons.GcShapeButton).AutoRepeat = True
End If
End Sub
Private Sub GcShapeButton1_KeyUp(sender As Object, e As KeyEventArgs)
If e.KeyValue = 32 Then
DirectCast(sender, GrapeCity.Win.Buttons.GcShapeButton).AutoRepeat = False
End If
End Sub
[C#]
private void gcShapeButton1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyValue == 32)
{
((GrapeCity.Win.Buttons.GcShapeButton)sender).AutoRepeat = true;
}
}
private void gcShapeButton1_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyValue == 32)
{
((GrapeCity.Win.Buttons.GcShapeButton)sender).AutoRepeat = false;
}
}
キーワード
PPWI20023