PowerTools SPREAD for Windows Forms 8.0J
StartEditing メソッド (IEditor)


イベント
すべてを選択するかどうか。
クリップボードアクションのショートカットキーを許可するかどうかを表すブール値
指定したオプションを使用してセルの編集を開始します。
構文
'Declaration
 
Sub StartEditing( _
   ByVal e As EventArgs, _
   ByVal selectAll As Boolean, _
   ByVal autoClipboard As Boolean _
) 
'使用法
 
Dim instance As IEditor
Dim e As EventArgs
Dim selectAll As Boolean
Dim autoClipboard As Boolean
 
instance.StartEditing(e, selectAll, autoClipboard)
void StartEditing( 
   EventArgs e,
   bool selectAll,
   bool autoClipboard
)

パラメータ

e
イベント
selectAll
すべてを選択するかどうか。
autoClipboard
クリップボードアクションのショートカットキーを許可するかどうかを表すブール値
解説
このメソッドは、Spread がセルに対して実際のエディタを作成した後に、エディタ上で呼び出されます。
次のサンプルコードは、メソッドとイベントの使用方法を説明するため、IEditorクラスをサブクラス化し、CheckBoxをセルエディタとして使用しています。
public static CheckBox ck = new CheckBox();

class myEditor : FarPoint.Win.Spread.CellType.IEditor
{
     public event EventHandler EditingCanceled;
     public event EventHandler EditingStopped;
     public bool StopEditing()
     {
          if (EditingStopped != null)
          {
               EditingStopped(ck, EventArgs.Empty);
               base.FireEditingStopped();
               return true;
          }
          else
          {
               return false;
          }
     }

     public void CancelEditing()
     {
          EditingCanceled(ck, EventArgs.Empty);
          base.FireEditingCanceled();
     }
     
     public bool IsReservedKey(KeyEventArgs e)
     {
          return false;
     }
          
     public bool IsValid(Object value)
     {
          return true;
     }
     
     public Size GetPreferredSize(System.Windows.Forms.Control editor)
     {
          return editor.Size;
     }

     public Cursor GetReservedCursor(object o)
     {
          return null;
     }

     public Control GetEditorControl(FarPoint.Win.Spread.Appearance appr, float zoom)
     {
          return ck;
     }

     public object GetEditorValue()
     {
          return ck.CheckState;
     }

     public void SetEditorValue(object value)
     {
     }

     public object IsReservedLocation(Graphics g, int x, int y, Rectangle r, FarPoint.Win.Spread.Appearance appr, object value,
float zoom)
     {
          return null;
     }

     public void StartEditing(EventArgs e, bool selectAll)
     {
          selectAll = true;
     }

     public void ShowSubEditor()
     {
     this.ShowSubEditor();
     }
}

private void Form1_Load(object sender, System.EventArgs e)
{
     fpSpread1.ActiveSheet.Cells[0, 0].Editor = new myEditor();
}
Shared ck As New CheckBox()

Public Class myEditor
Implements FarPoint.Win.Spread.CellType.IEditor

     Public Event EditingStopped(ByVal sender As Object, ByVal e As EventArgs) Implements FarPoint.Win.Spread.CellType.IEditor.EditingStopped

     Public Event EditingCancelled(ByVal sender As Object, ByVal e As EventArgs) Implements FarPoint.Win.Spread.CellType.IEditor.EditingCanceled

     Public Function StopEditing() As Boolean Implements FarPoint.Win.Spread.CellType.IEditor.StopEditing
          RaiseEvent EditingStopped(ck, EventArgs.Empty)
          MyBase.FireEditingStopped()
          Return True
     End Function

     Public Sub CancelEditing() Implements FarPoint.Win.Spread.CellType.IEditor.CancelEditing
          RaiseEvent EditingCancelled(ck, EventArgs.Empty)
          MyBase.FireEditingCanceled()
     End Sub

     Public Function IsReservedKey(ByVal e As KeyEventArgs) As Boolean Implements FarPoint.Win.Spread.CellType.IEditor.IsReservedKey
          Return False
     End Function

     Public Function IsValid(ByVal value As Object) As Boolean Implements FarPoint.Win.Spread.CellType.IEditor.IsValid
          Return True
     End Function

     Public Function GetReservedCursor(ByVal o As Object) As Cursor Implements FarPoint.Win.Spread.CellType.IEditor.GetReservedCursor
          Return Nothing
     End Function

     Public Function GetEditorControl(ByVal appr As FarPoint.Win.Spread.Appearance, ByVal zoom As Single) As Control Implements
FarPoint.Win.Spread.CellType.IEditor.GetEditorControl
          Return ck
     End Function

     Public Function GetEditorValue() As Object Implements FarPoint.Win.Spread.CellType.IEditor.GetEditorValue
          Return ck.CheckState
     End Function

     Public Function GetPreferredSize(ByVal editor As System.Windows.Forms.Control) As Size Implements FarPoint.Win.Spread.CellType.IEditor.GetPreferredSize
          Return editor.Size
     End Function

     Public Sub SetEditorValue(ByVal value As Object) Implements FarPoint.Win.Spread.CellType.IEditor.SetEditorValue
          ck.CheckState = CheckState.Checked
     End Sub

     Public Function IsReservedLocation(ByVal g As Graphics, ByVal x As Integer, ByVal y As Integer, ByVal r As Rectangle,
ByVal appr As FarPoint.Win.Spread.Appearance, ByVal value As Object, ByVal zoom As Single) As Object Implements FarPoint.Win.Spread.CellType.IEditor.IsReservedLocation
          Return Nothing
     End Function

     Public Sub StartEditing(ByVal e As EventArgs, ByVal selectAll As Boolean) Implements FarPoint.Win.Spread.CellType.IEditor.StartEditing
               selectAll = True
     End Sub

     Public Sub ShowSubEditor() Implements FarPoint.Win.Spread.CellType.IEditor.ShowSubEditor
               Me.ShowSubEditor()
     End Sub
End Class

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     FpSpread1.ActiveSheet.Cells(0, 0).Editor = New myEditor()
End Sub
参照

IEditor インタフェース
IEditor メンバ
FpSpread.EditMode プロパティ

 

 


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