本文整理汇总了C#中System.Windows.Forms.CheckBox.CreateControl方法的典型用法代码示例。如果您正苦于以下问题:C# CheckBox.CreateControl方法的具体用法?C# CheckBox.CreateControl怎么用?C# CheckBox.CreateControl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.CheckBox
的用法示例。
在下文中一共展示了CheckBox.CreateControl方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestTwoWayBindingWithPropertyChangeNotification
public void TestTwoWayBindingWithPropertyChangeNotification()
{
IBusinessObject businessObject = new BusinessObject();
businessObject.Name = "Foo";
CheckBox checkbox = new CheckBox();
checkbox.CreateControl();
checkbox.BindingContext = new BindingContext();
using (BindingScope scope = new BindingScope())
{
IBusinessObject bindableSource = scope.CreateSource(businessObject);
CheckBox bindableTarget = scope.CreateTarget(checkbox);
scope.Bind(bindableSource.Name).To(bindableTarget.Text);
Assert.AreEqual(1, checkbox.DataBindings.Count);
Assert.AreSame(businessObject, checkbox.DataBindings[0].DataSource);
Assert.AreEqual(businessObject.Name, checkbox.Text);
checkbox.Text = "Bar";
checkbox.DataBindings[0].WriteValue();
Assert.AreEqual(checkbox.Text, businessObject.Name);
businessObject.Name = "Baz";
Assert.AreEqual(businessObject.Name, checkbox.Text);
}
}