Selected

OptionButtonControl.Selected property

Ruft einen booleschen Wert ab oder setzt ihn, der entweder dies angibtOptionButtonControl ausgewählt ist oder nicht.

public bool Selected { get; set; }

Bemerkungen

Beachten Sie, dass Sie mit dieser Eigenschaft mehrere Elemente in einer Gruppe vonOptionButtonControl mit dem gleichenGroupName . Es liegt an Ihnen, sich um die Abwahl eines zuvor ausgewählten Elements zu kümmern, wenn Sie dies tunOptionButtonControl ausgewählt.

Beispiele

Zeigt, wie ein Optionsfeld ausgewählt wird.

Document doc = new Document(MyDir + "Radio buttons.docx");

Shape shape1 = (Shape)doc.GetChild(NodeType.Shape, 0, true);
OptionButtonControl optionButton1 = (OptionButtonControl)shape1.OleFormat.OleControl;
// Auswahl des ersten ausgewählten Elements aufheben.
optionButton1.Selected = false;

Shape shape2 = (Shape)doc.GetChild(NodeType.Shape, 1, true);
OptionButtonControl optionButton2 = (OptionButtonControl)shape2.OleFormat.OleControl;
// Wählen Sie die zweite Optionsschaltfläche aus.
optionButton2.Selected = true;

Assert.AreEqual(Forms2OleControlType.OptionButton, optionButton1.Type);
Assert.AreEqual(Forms2OleControlType.OptionButton, optionButton2.Type);

doc.Save(ArtifactsDir + "Shape.SelectRadioControl.docx");

Siehe auch