public class SpreadTextBox : TextBox, FarPoint.Win.Spread.DrawingSpace.IEmbeddedControlSupport
{
private FarPoint.Win.Spread.DrawingSpace.Moving moving = FarPoint.Win.Spread.DrawingSpace.Moving.None;
private FarPoint.Win.Spread.DrawingSpace.Sizing sizing = FarPoint.Win.Spread.DrawingSpace.Sizing.None;
private FarPoint.Win.Spread.DrawingSpace.ChildActivationPolicy activation = FarPoint.Win.Spread.DrawingSpace.ChildActivationPolicy.DoubleClick;
public virtual FarPoint.Win.Spread.DrawingSpace.ChildActivationPolicy ActivationPolicy
{
get
{
return activation;
}
set
{
}
}
public virtual FarPoint.Win.Spread.DrawingSpace.Moving CanMove
{
get
{
return moving;
}
set
{
moving = value;
}
}
public virtual FarPoint.Win.Spread.DrawingSpace.Sizing CanSize
{
get
{
return sizing;
}
set
{
sizing = value;
}
}
public void ControlPaint(Graphics g, Rectangle r, FarPoint.Win.Spread.Appearance appearance, object value, bool isSelected,
bool isLocked, float zoomFactor)
{
g.SetClip(r, System.Drawing.Drawing2D.CombineMode.Intersect);
g.FillRectangle(new SolidBrush(this.BackColor), r);
g.DrawString(this.Text, Font, new SolidBrush(this.ForeColor), r.X, r.Y);
this.TextChanged += new EventHandler(MeTextChanged);
}
public void MeTextChanged(object sender, EventArgs e)
{
this.BackColor = Color.Beige;
}
}
private void Form1_Load(object sender, EventArgs e)
{
SpreadTextBox tb = new SpreadTextBox();
tb.Name = "TB";
fpSpread1.ActiveSheet.AddControl(tb, 2, 2);
fpSpread1.RemoveControl(tb, 0);
}