TextBoxControl

TextBoxControl class

TextBox 控件显示来自有组织的数据集或用户输入的文本。

public class TextBoxControl : MorphDataControl

特性

姓名描述
BackColor { get; set; }获取或设置控件的背景颜色。 默认值取决于控件的类型。
Caption { get; set; }获取或设置控件的 Caption 属性。 默认值为空字符串。
virtual ChildNodes { get; }获取直接子控件的集合。
Enabled { get; }返回真的如果控制处于启用状态。
ForeColor { get; set; }获取或设置控件的前景色。 默认值取决于控件的类型。
GroupName { get; set; }获取或设置指定一组互斥控件的字符串。 默认值为空字符串。
Height { get; set; }获取或设置控件的高度(以点为单位)。
IsForms2OleControl { get; }返回真的如果控件是Forms2OleControl.
Name { get; set; }获取或设置 ActiveX 控件的名称。
Text { get; set; }获取或设置控件的文本。
override Type { get; }获取 Forms 2.0 控件的类型。
Value { get; }获取通常代表控制状态的底层 Value 属性。 例如,选中的选项按钮的值为“1”,而未选中的选项按钮的值为“0”。 默认值为空字符串。
Width { get; set; }获取或设置控件的宽度(以点为单位)。

例子

展示如何更改 TextBox OLE 控件的文本。

Document doc = new Document(MyDir + "Textbox control.docm");

Shape shape = (Shape)doc.GetChild(NodeType.Shape, 0, true);
TextBoxControl textBoxControl = (TextBoxControl)shape.OleFormat.OleControl;
Assert.AreEqual("Aspose.Words test", textBoxControl.Text);

textBoxControl.Text = "Updated text";
Assert.AreEqual("Updated text", textBoxControl.Text);
Assert.AreEqual(Forms2OleControlType.Textbox, textBoxControl.Type);

也可以看看