public partial class Form2 : System.Windows.Forms.Form, FarPoint.Win.Spread.CellType.ISubEditor
{
public event System.EventHandler CloseUp;
public event System.EventHandler ValueChanged;
public Form2()
{
InitializeComponent();
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form2_FormClosing);
}
public Point GetLocation(Rectangle rect)
{
//フォームの表示位置を指定します
return new Point(rect.X + 10, rect.Y + 20);
}
public Control GetSubEditorControl()
{
// このフォームを返します
return this;
}
public Size GetPreferredSize()
{
//フォームのサイズを設定します
return this.Size;
}
public object GetValue()
{
//テキストボックスの値を返します
return textBox1.Text;
}
public void SetValue(object value)
{
//テキストボックスの値を設定します
textBox1.Text = value.ToString();
}
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
{
//フォーム終了時にイベントを発生させます
if (ValueChanged != null)
ValueChanged(this, EventArgs.Empty);
if (CloseUp != null)
CloseUp(this, EventArgs.Empty);
}
}
Public Class Form2
Inherits System.Windows.Forms.Form
Implements FarPoint.Win.Spread.CellType.ISubEditor
Public Event CloseUp(ByVal sender As Object, ByVal e As System.EventArgs) Implements FarPoint.Win.Spread.CellType.ISubEditor.CloseUp
Public Event ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Implements FarPoint.Win.Spread.CellType.ISubEditor.ValueChanged
Public Function GetLocation(ByVal rect As System.Drawing.Rectangle) As System.Drawing.Point Implements FarPoint.Win.Spread.CellType.ISubEditor.GetLocation
'フォームの表示位置を指定します
Return New Point(rect.X + 10, rect.Y + 20)
End Function
Public Shadows Function GetPreferredSize() As System.Drawing.Size Implements FarPoint.Win.Spread.CellType.ISubEditor.GetPreferredSize
'フォームのサイズを設定します
Return Me.Size
End Function
Public Function GetSubEditorControl() As System.Windows.Forms.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 TextBox1.Text
End Function
Public Sub SetValue(ByVal value As Object) Implements FarPoint.Win.Spread.CellType.ISubEditor.SetValue
'テキストボックスの値を設定します
TextBox1.Text = value
End Sub
Private Sub Form2_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
'フォーム終了時にイベントを発生させます
RaiseEvent ValueChanged(Me, EventArgs.Empty)
RaiseEvent CloseUp(Me, EventArgs.Empty)
End Sub
End Class