編集終了後にGcTextBox型セルのパスワード文字が表示されない場合がある
対象製品
SPREAD for Windows Forms 8.0J
状況
修正済み
詳細
GcTextBox型セルのFormatStringプロパティを設定した場合、編集終了後にパスワード文字が表示されません。
【手順】
1.新規フォームにSPREADを配置します
2.下記サンプルコードをコピーし、アプリケーションを実行します
3.A1セルに「a」を入力します
4.B1セルをクリックし、セルの編集を終了します
--A1セルに入力した値(*)が表示されません
【サンプルコード】
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim gctc As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
gctc.FormatString = "Aa"
gctc.PasswordChar = Chr(42)
FpSpread1.ActiveSheet.Columns(0).CellType = gctc
End Sub
【手順】
1.新規フォームにSPREADを配置します
2.下記サンプルコードをコピーし、アプリケーションを実行します
3.A1セルに「a」を入力します
4.B1セルをクリックし、セルの編集を終了します
--A1セルに入力した値(*)が表示されません
【サンプルコード】
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim gctc As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
gctc.FormatString = "Aa"
gctc.PasswordChar = Chr(42)
FpSpread1.ActiveSheet.Columns(0).CellType = gctc
End Sub
回避方法
Service Pack 1(v8.0.3502.2008)で修正済み。
Service Pack 1(v8.0.3502.2008)より前のバージョンでは次の回避方法が有効です。
------------------------------------------
◆ 回避方法1
GcTextBoxCellTypeを継承した独自のセル型を作成します。
【サンプルコード】
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Dim gctc As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
Dim gctc As New MyGcTextBoxCellType()
gctc.FormatString = "Aa"
gctc.PasswordChar = Chr(42)
FpSpread1.ActiveSheet.Columns(0).CellType = gctc
End Sub
<Serializable()> Public Class MyGcTextBoxCellType
Inherits GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType
Public Overrides Function GetDisplayText(ByVal value As Object) As String
If TypeOf value Is String AndAlso value.ToString().Replace(Me.PasswordChar.ToString, "").Length = 0 Then
Return value.ToString
Else
Return MyBase.GetDisplayText(value)
End If
End Function
End Class
◆ 回避方法2
FormatStringにPasswordCharの文字を追加します。
【サンプルコード】
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim gctc As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
gctc.FormatString = "Aa*"
gctc.PasswordChar = Chr(42)
FpSpread1.ActiveSheet.Columns(0).CellType = gctc
End Sub
Service Pack 1(v8.0.3502.2008)より前のバージョンでは次の回避方法が有効です。
------------------------------------------
◆ 回避方法1
GcTextBoxCellTypeを継承した独自のセル型を作成します。
【サンプルコード】
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Dim gctc As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
Dim gctc As New MyGcTextBoxCellType()
gctc.FormatString = "Aa"
gctc.PasswordChar = Chr(42)
FpSpread1.ActiveSheet.Columns(0).CellType = gctc
End Sub
<Serializable()> Public Class MyGcTextBoxCellType
Inherits GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType
Public Overrides Function GetDisplayText(ByVal value As Object) As String
If TypeOf value Is String AndAlso value.ToString().Replace(Me.PasswordChar.ToString, "").Length = 0 Then
Return value.ToString
Else
Return MyBase.GetDisplayText(value)
End If
End Function
End Class
◆ 回避方法2
FormatStringにPasswordCharの文字を追加します。
【サンプルコード】
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim gctc As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
gctc.FormatString = "Aa*"
gctc.PasswordChar = Chr(42)
FpSpread1.ActiveSheet.Columns(0).CellType = gctc
End Sub