OptionButtonControl
Contents
[
Hide
]OptionButtonControl class
The OptionButton control enables a single choice in a limited set of mutually exclusive choices.
public class OptionButtonControl : MorphDataControl
Properties
Name | Description |
---|---|
BackColor { get; set; } | Gets or sets a background color of the control. The default value depends on a type of the control. |
Caption { get; } | Gets Caption property of control. Default value is an empty string. |
virtual ChildNodes { get; } | Gets collection of immediate child controls. |
Enabled { get; } | Returns true if control is in enabled state. |
ForeColor { get; set; } | Gets or sets a foreground color of the control. The default value depends on a type of the control. |
GroupName { get; set; } | Gets or sets a string that specifies a group of mutually exclusive controls. The default value is an empty string. |
Height { get; set; } | Gets or sets a height of the control in points. |
IsForms2OleControl { get; } | Returns true if the control is a Forms2OleControl . |
Name { get; set; } | Gets or sets name of the ActiveX control. |
Selected { get; set; } | Gets or sets a boolean value indicating either this OptionButtonControl is selected or not. |
override Type { get; } | Gets type of Forms 2.0 control. |
Value { get; } | Gets underlying Value property which often represents control state. For example checked option button has ‘1’ value while unchecked has ‘0’. Default value is an empty string. |
Width { get; set; } | Gets or sets a width of the control in points. |
Examples
Shows how to select radio button.
Document doc = new Document(MyDir + "Radio buttons.docx");
Shape shape1 = (Shape)doc.GetChild(NodeType.Shape, 0, true);
OptionButtonControl optionButton1 = (OptionButtonControl)shape1.OleFormat.OleControl;
// Deselect selected first item.
optionButton1.Selected = false;
Shape shape2 = (Shape)doc.GetChild(NodeType.Shape, 1, true);
OptionButtonControl optionButton2 = (OptionButtonControl)shape2.OleFormat.OleControl;
// Select second option button.
optionButton2.Selected = true;
Assert.AreEqual(Forms2OleControlType.OptionButton, optionButton1.Type);
Assert.AreEqual(Forms2OleControlType.OptionButton, optionButton2.Type);
doc.Save(ArtifactsDir + "Shape.SelectRadioControl.docx");
See Also
- class MorphDataControl
- namespace Aspose.Words.Drawing.Ole
- assembly Aspose.Words