Spread Windows Forms 8.0 Product Documentation
ShowSubEditor Method (GeneralEditor)
Example 


Whether to show the subeditor control (Boolean)

Shows or hides the subeditor control associated with the cell.
Syntax
'Declaration
 
Public Overridable Sub ShowSubEditor( _
   ByVal bShow As Boolean _
) 
'Usage
 
Dim instance As GeneralEditor
Dim bShow As Boolean
 
instance.ShowSubEditor(bShow)
public virtual void ShowSubEditor( 
   bool bShow
)

Parameters

bShow

Whether to show the subeditor control (Boolean)

Example
public class mySubEd : Form, FarPoint.Win.Spread.CellType.ISubEditor 
{ 
public event EventHandler ValueChanged; 
public event EventHandler CloseUp; 
private TextBox txt = null; 
private Button BtnOk = null; 
private Button BtnCancel = null; 
  
public mySubEd() 
{ 
      FormBorderStyle = FormBorderStyle.FixedSingle; 
      MaximizeBox = false; 
      MinimizeBox = false; 
      ControlBox = false; 
      txt = new TextBox(); 
      BtnOk = new Button(); 
      BtnCancel = new Button(); 
      txt.Location = new Point(0, 0); 
      txt.Size = new Size(110, 200); 
      txt.ForeColor = Color.Red; 
      BtnOk.Location = new Point(3, 75); 
      BtnOk.Size = new Size(50, 25); 
      BtnOk.Text = "OK"; 
      BtnOk.ForeColor = Color.Red; 
      BtnCancel.Location = new Point(57, 75); 
      BtnCancel.Size = new Size(50, 25); 
      BtnCancel.Text = "Cancel"; 
      BtnCancel.ForeColor = Color.Red; 
      Controls.Add(txt); 
      Controls.Add(BtnOk); 
      Controls.Add(BtnCancel); 
      Text = "Editor"; 
      BtnOk.Click += new EventHandler(OKClicked); 
      BtnCancel.Click += new EventHandler(CancelClicked); 
      txt.TextChanged += new EventHandler(txtTextChanged); 
} 
 
private void OKClicked(object sender, EventArgs e) 
{ 
      if (ValueChanged != null) 
            ValueChanged(this, EventArgs.Empty); 
      if (CloseUp != null) 
            CloseUp(this, EventArgs.Empty); 
} 
 
private void CancelClicked(object sender, EventArgs e) 
{ 
      if (CloseUp != null) 
            CloseUp(this, EventArgs.Empty); 
} 
 
private void txtTextChanged(object sender, EventArgs e) 
{ 
      Text = txt.Text; 
} 
 
public Point GetLocation(Rectangle rect) 
{ 
      Point pt = new Point(0); 
      Size sz = GetPreferredSize(); 
      pt.Y = (Screen.PrimaryScreen.WorkingArea.Height/2) - (sz.Height/2); 
      pt.X = (Screen.PrimaryScreen.WorkingArea.Width/2) - (sz.Width/2); 
      return pt; 
} 

public Control GetSubEditorControl() 
{ 
      return this; 
} 

public object GetValue() 
{ 
      return txt.Text; 
} 

public void SetValue(object value) 
{ 
      value = txt.Text; 
} 

public Size GetPreferredSize() 
{ 
      return new Size(115, 130); 
} 

} 

FarPoint.Win.Spread.CellType.GeneralEditor ge = (FarPoint.Win.Spread.CellType.GeneralEditor)fpSpread1.EditingControl; 
ge.BorderStyle = BorderStyle.Fixed3D; 
ge.SubEditor = new mySubEd();
ge.ShowSubEditor(true);
Public Class tEditor
Inherits Form
Implements FarPoint.Win.Spread.CellType.ISubEditor

Public Event CloseUp(ByVal sender As Object, ByVal e As EventArgs) Implements FarPoint.Win.Spread.CellType.ISubEditor.CloseUp
Public Event ValueChanged(ByVal sender As Object, ByVal e As EventArgs) Implements FarPoint.Win.Spread.CellType.ISubEditor.ValueChanged
Private BtnOk As Button = Nothing
Private BtnCancel As Button = Nothing
Private txt As TextBox = Nothing


Public Sub New()
      FormBorderStyle = FormBorderStyle.FixedSingle
      MaximizeBox = False
      MinimizeBox = False
      ControlBox = False
      txt = New TextBox
      BtnOk = New Button
      BtnCancel = New Button
      txt.Location = New Point(0, 0)
      txt.Size = New Size(110, 200)
      txt.ForeColor = Color.Red
      BtnOk.Location = New Point(3, 75)
      BtnOk.Size = New Size(50, 25)
      BtnOk.Text = "OK"
      BtnOk.ForeColor = Color.Red
      BtnCancel.Location = New Point(57, 75)
      BtnCancel.Size = New Size(50, 25)
      BtnCancel.Text = "Cancel"
      BtnCancel.ForeColor = Color.Red
      Controls.Add(txt)
      Controls.Add(BtnOk)
      Controls.Add(BtnCancel)
      Text = "TextEditor"
      AddHandler BtnOk.Click, AddressOf OKClicked
      AddHandler BtnCancel.Click, AddressOf CloseClicked
      AddHandler txt.TextChanged, AddressOf txtTextChanged
End Sub

Private Sub OKClicked(ByVal sender As Object, ByVal e As EventArgs)
      RaiseEvent ValueChanged(Me, EventArgs.Empty)
      RaiseEvent CloseUp(Me, EventArgs.Empty)
End Sub

Private Sub CloseClicked(ByVal sender As Object, ByVal e As EventArgs)
      RaiseEvent CloseUp(Me, EventArgs.Empty)
End Sub

Private Sub txtTextChanged(ByVal sender As Object, ByVal e As EventArgs)
      Text = txt.Text
End Sub

Public Function GetLocation(ByVal rect As Rectangle) As Point Implements FarPoint.Win.Spread.CellType.ISubEditor.GetLocation
      Dim pt As New Point(0)
      Dim sz As Size = GetPreferredSize()
      pt.Y = (Screen.PrimaryScreen.WorkingArea.Height / 2) - (sz.Height / 2)
      pt.X = (Screen.PrimaryScreen.WorkingArea.Width / 2) - (sz.Width / 2) + 270
      Return pt
End Function

Public Function GetPreferredSize() As Size Implements FarPoint.Win.Spread.CellType.ISubEditor.GetPreferredSize
      Return New Size(115, 130)
End Function

Public Function GetSubEditorControl() As Control Implements FarPoint.Win.Spread.CellType.ISubEditor.GetSubEditorControl
      Return Me
End Function

Public Function GetValue() As Object Implements FarPoint.Win.Spread.CellType.ISubEditor.GetValue
      Return txt.Text
End Function

Public Sub SetValue(ByVal value As Object) Implements FarPoint.Win.Spread.CellType.ISubEditor.SetValue
            txt.Text = value
End Sub

Dim ge As FarPoint.Win.Spread.CellType.GeneralEditor = CType(FpSpread1.EditingControl, FarPoint.Win.Spread.CellType.GeneralEditor)
ge.BorderStyle = BorderStyle.Fixed3D
ge.SubEditor = New tEditor
ge.ShowSubEditor(True)
Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8

See Also

Reference

GeneralEditor Class
GeneralEditor Members

 

 


Copyright © GrapeCity, inc. All rights reserved.