Share via


Behavior 构造函数

定义

初始化 Behavior 类的新实例。

重载

Behavior()

初始化 Behavior 类的新实例。

Behavior(Boolean, BehaviorService)

用给定的 Behavior 初始化 BehaviorService 类的新实例。

Behavior()

初始化 Behavior 类的新实例。

protected:
 Behavior();
protected Behavior ();
Protected Sub New ()

示例

下面的代码示例演示如何初始化 Behavior 类的新实例。 此代码示例是为 BehaviorService 类提供的一个更大示例的一部分。

public:
    DemoGlyph(BehaviorService^ behavior, Control^ control):
      Glyph(gcnew BehaviorServiceSample::DemoBehavior)
      {
          this->behavior = behavior;
          this->control = control;
      }
public MyGlyph(BehaviorService behaviorSvc, Control control) : 
    base(new MyBehavior())
{
    this.behaviorSvc = behaviorSvc;
    this.control = control;
}
Public Sub New(ByVal behaviorSvc As _
    System.Windows.Forms.Design.Behavior.BehaviorService, _
    ByVal control As Control)

    MyBase.New(New MyBehavior())
    Me.behaviorSvc = behaviorSvc
    Me.control = control
End Sub

另请参阅

适用于

Behavior(Boolean, BehaviorService)

用给定的 Behavior 初始化 BehaviorService 类的新实例。

protected:
 Behavior(bool callParentBehavior, System::Windows::Forms::Design::Behavior::BehaviorService ^ behaviorService);
protected Behavior (bool callParentBehavior, System.Windows.Forms.Design.Behavior.BehaviorService behaviorService);
protected Behavior (bool callParentBehavior, System.Windows.Forms.Design.Behavior.BehaviorService? behaviorService);
new System.Windows.Forms.Design.Behavior.Behavior : bool * System.Windows.Forms.Design.Behavior.BehaviorService -> System.Windows.Forms.Design.Behavior.Behavior
Protected Sub New (callParentBehavior As Boolean, behaviorService As BehaviorService)

参数

callParentBehavior
Boolean

如果应该调用父行为(如果存在),则为 true;否则为 false

behaviorService
BehaviorService

要使用的 BehaviorService

例外

callParentBehaviortruebehaviorServicenull

注解

父行为是由 维护 BehaviorService的行为堆栈上的下一个行为。 callParentBehavior如果参数为 true,则behaviorService参数不得为 null

callParentBehavior 指示基 Behavior 类是否应调用父行为,然后允许 BehaviorService 选择正确的父行为。

适用于