Behavior Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the Behavior class.
Overloads
| Behavior() | Initializes a new instance of the Behavior class. | 
| Behavior(Boolean, BehaviorService) | Initializes a new instance of the Behavior class with the given BehaviorService. | 
Behavior()
- Source:
- Behavior.cs
- Source:
- Behavior.cs
- Source:
- Behavior.cs
Initializes a new instance of the Behavior class.
protected:
 Behavior();protected Behavior();Protected Sub New ()Examples
The following code example demonstrates how to initialize a new instance of the Behavior class. This code example is part of a larger example provided for the BehaviorService class.
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
See also
- Glyph
- BehaviorService
- MenuCommand
- How to: Extend the Appearance and Behavior of Controls in Design Mode
- Behavior Service Overview
Applies to
Behavior(Boolean, BehaviorService)
- Source:
- Behavior.cs
- Source:
- Behavior.cs
- Source:
- Behavior.cs
Initializes a new instance of the Behavior class with the given 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.BehaviorProtected Sub New (callParentBehavior As Boolean, behaviorService As BehaviorService)Parameters
- callParentBehavior
- Boolean
true if the parent behavior should be called if it exists; otherwise, false.
- behaviorService
- BehaviorService
The BehaviorService to use.
Exceptions
callParentBehavior is true, and behaviorService is null.
Remarks
The parent behavior is the next behavior on the behavior stack maintained by the BehaviorService. If the callParentBehavior parameter is true, then the behaviorService parameter must not be null.
callParentBehavior indicates whether the base Behavior class should call the parent behavior, and then allow the BehaviorService select the correct parent behavior.