共用方式為


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

例外狀況

callParentBehaviortrue,而 behaviorServicenull

備註

父行為是 所 BehaviorService維護之行為堆疊上的下一個行為。 callParentBehavior如果 參數為 true,則behaviorService參數不得為 null

callParentBehavior 指出基 Behavior 類是否應該呼叫父行為,然後允許 BehaviorService 選取正確的父行為。

適用於