PowerTools SPREAD for Windows Forms 8.0J 移行ガイド
カスタムセルを設定するとセルの編集終了時に、セルの値がクリアされる


ステータス

バージョン ID 機能分類 対応策
1.1.0.0 11004 編集

詳細

旧バージョンでは、カスタムセルの編集終了時に常に編集用コントロールの値をシートに設定していました。本バージョンで は、編集用コントロールの Modified プロパティの値が True の場合のみセルの値をシートに設定します。編集用コントロールの Modified プロパティが True にならないような変更を行う場合には、明示的に Modified プロパティを True に設定する必要があります。

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }
    private void Form1_Load(object sender, EventArgs e)
    {
        fpSpread1.ActiveSheet.Cells[1, 1].CellType = new CustomCellType();
    }
}

[Serializable()]
class CustomCellType : FarPoint.Win.Spread.CellType.GeneralCellType
{
    TextBox textBox1 = new TextBox();
    public override Control GetEditorControl(FarPoint.Win.Spread.Appearance appearance, float zoomFactor)
    {
        return textBox1;
    }
    public override object GetEditorValue()
    {
        return textBox1.Text;
    }
    public override void SetEditorValue(object value)
    {
        textBox1.Text = "abc";
        // 編集用コントロールのModifiedをTrue にします
        textBox1.Modified = true;
    }
}
<Serializable()> Public Class CustomCellType
    Inherits FarPoint.Win.Spread.CellType.GeneralCellType

    Private textBox1 As New TextBox

    Public Overrides Function GetEditorControl(ByVal appearance As FarPoint.Win.Spread.Appearance, ByVal zoomFactor As Single) As System.Windows.Forms.Control
        Return textBox1
    End Function

    Public Overrides Function GetEditorValue() As Object
        Return textBox1.Text
    End Function

    Public Overrides Sub SetEditorValue(ByVal value As Object)
        textBox1.Text = "abc"
        ' 編集用コントロールのModifiedをTrue にします 
        textBox1.Modified = True
    End Sub
End Class

関連トピック

 

 


© 2004-2015, GrapeCity inc. All rights reserved.