[ELTB03207]ラベル型セルで Delete キーを押すとキャプションが消える
対象製品
El Tabelle for .NET
発生環境
この現象はすべてのアセンブリで発生します。
詳細
ラベル型セルで Text プロパティに Null を設定し、シートの Text/Value をキャプションとして使うとき、
ラベル型セルで Delete キーを押すとキャプションが消えてしまいます。
ラベル型セルで Delete キーを押すとキャプションが消えてしまいます。
回避方法
この現象は製品の仕様によるものです。
次のいずれかの操作を行うことで現象を回避できます。
・Text プロパティにキャプションを設定する
[Visual Basic]
Dim objLabelEditor As New GrapeCity.Win.Editors.LabelEditor
objLabelEditor.Text = "ラベル"
Sheet1.CellPosition = New GrapeCity.Views.ElTabelle.Position("A1")
Sheet1.CellEditor = objLabelEditor
[C#]
GrapeCity.Win.Editors.LabelEditor objLabelEditor = new GrapeCity.Win.Editors.LabelEditor();
objLabelEditor.Text = "ラベル";
sheet1.CellPosition = new GrapeCity.Views.ElTabelle.Position("A1");
sheet1.CellEditor = objLabelEditor;
・ラベル型セルを保護(ロック)する
[Visual Basic]
Dim objLabelEditor As New GrapeCity.Win.Editors.LabelEditor
objLabelEditor.Text = Nothing
Sheet1.CellPosition = New GrapeCity.Views.ElTabelle.Position("A1")
Sheet1.CellEditor = objLabelEditor
Sheet1.CellValue = "ラベル"
Sheet1.CellLock = True
Sheet1.Protect = True
[C#]
GrapeCity.Win.Editors.LabelEditor objLabelEditor = new GrapeCity.Win.Editors.LabelEditor();
objLabelEditor.Text = null;
sheet1.CellPosition = new GrapeCity.Views.ElTabelle.Position("A1");
sheet1.CellEditor = objLabelEditor;
sheet1.CellValue = "ラベル";
sheet1.CellLock = true;
sheet1.Protect = true;
・ラベル型セルにおける Delete キーの操作を無効にする
[Visual Basic]
Private Sub Sheet1_KeyDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles Sheet1.KeyDown
If e.KeyValue = Keys.Delete Then
If Sheet1.ActiveCell.Editor.GetType.Name = "LabelEditor" Then
e.Handled = True
End If
End If
End Sub
[C#]
private void sheet1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyValue == Keys.Delete)
{
if(Sheet1.ActiveCell.Editor.GetType.Name == "LabelEditor")
{
e.Handled = true;
}
}
}
次のいずれかの操作を行うことで現象を回避できます。
・Text プロパティにキャプションを設定する
[Visual Basic]
Dim objLabelEditor As New GrapeCity.Win.Editors.LabelEditor
objLabelEditor.Text = "ラベル"
Sheet1.CellPosition = New GrapeCity.Views.ElTabelle.Position("A1")
Sheet1.CellEditor = objLabelEditor
[C#]
GrapeCity.Win.Editors.LabelEditor objLabelEditor = new GrapeCity.Win.Editors.LabelEditor();
objLabelEditor.Text = "ラベル";
sheet1.CellPosition = new GrapeCity.Views.ElTabelle.Position("A1");
sheet1.CellEditor = objLabelEditor;
・ラベル型セルを保護(ロック)する
[Visual Basic]
Dim objLabelEditor As New GrapeCity.Win.Editors.LabelEditor
objLabelEditor.Text = Nothing
Sheet1.CellPosition = New GrapeCity.Views.ElTabelle.Position("A1")
Sheet1.CellEditor = objLabelEditor
Sheet1.CellValue = "ラベル"
Sheet1.CellLock = True
Sheet1.Protect = True
[C#]
GrapeCity.Win.Editors.LabelEditor objLabelEditor = new GrapeCity.Win.Editors.LabelEditor();
objLabelEditor.Text = null;
sheet1.CellPosition = new GrapeCity.Views.ElTabelle.Position("A1");
sheet1.CellEditor = objLabelEditor;
sheet1.CellValue = "ラベル";
sheet1.CellLock = true;
sheet1.Protect = true;
・ラベル型セルにおける Delete キーの操作を無効にする
[Visual Basic]
Private Sub Sheet1_KeyDown(ByVal sender As Object, _
ByVal e As System.Windows.Forms.KeyEventArgs) Handles Sheet1.KeyDown
If e.KeyValue = Keys.Delete Then
If Sheet1.ActiveCell.Editor.GetType.Name = "LabelEditor" Then
e.Handled = True
End If
End If
End Sub
[C#]
private void sheet1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
if(e.KeyValue == Keys.Delete)
{
if(Sheet1.ActiveCell.Editor.GetType.Name == "LabelEditor")
{
e.Handled = true;
}
}
}
この文書は、以前は次のFAQ IDで公開されていました : 3151