Επεξεργασία

Κοινή χρήση μέσω


ISupportInitialize Interface

Definition

Specifies that this object supports a simple, transacted notification for batch initialization.

public interface class ISupportInitialize
public interface ISupportInitialize
type ISupportInitialize = interface
Public Interface ISupportInitialize
Derived

Examples

The following code example demonstrates how to use the ISupportInitialize interface to initialize three TrackBar controls.

(dynamic_cast<System::ComponentModel::ISupportInitialize^>(this->trackBar1))->BeginInit();
(dynamic_cast<System::ComponentModel::ISupportInitialize^>(this->trackBar2))->BeginInit();
(dynamic_cast<System::ComponentModel::ISupportInitialize^>(this->trackBar3))->BeginInit();
this->SuspendLayout();

//
// trackBar1
//
this->trackBar1->Location = System::Drawing::Point( 160, 400 );
this->trackBar1->Name = "trackBar1";
this->trackBar1->TabIndex = 1;
this->trackBar1->Scroll += gcnew System::EventHandler( this, &Form1::trackBar_Scroll );

//
// trackBar2
//
this->trackBar2->Location = System::Drawing::Point( 608, 40 );
this->trackBar2->Name = "trackBar2";
this->trackBar2->TabIndex = 2;
this->trackBar2->Scroll += gcnew System::EventHandler( this, &Form1::trackBar_Scroll );

//
// trackBar3
//
this->trackBar3->Location = System::Drawing::Point( 56, 40 );
this->trackBar3->Name = "trackBar3";
this->trackBar3->TabIndex = 3;
this->trackBar3->Scroll += gcnew System::EventHandler( this, &Form1::trackBar_Scroll );
(dynamic_cast<System::ComponentModel::ISupportInitialize^>(this->trackBar1))->EndInit();
(dynamic_cast<System::ComponentModel::ISupportInitialize^>(this->trackBar2))->EndInit();
(dynamic_cast<System::ComponentModel::ISupportInitialize^>(this->trackBar3))->EndInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar3)).BeginInit();
this.SuspendLayout();
//
// trackBar1
//
this.trackBar1.Location = new System.Drawing.Point(160, 400);
this.trackBar1.Name = "trackBar1";
this.trackBar1.TabIndex = 1;
this.trackBar1.Scroll += new System.EventHandler(this.trackBar_Scroll);
//
// trackBar2
//
this.trackBar2.Location = new System.Drawing.Point(608, 40);
this.trackBar2.Name = "trackBar2";
this.trackBar2.TabIndex = 2;
this.trackBar2.Scroll += new System.EventHandler(this.trackBar_Scroll);
//
// trackBar3
//
this.trackBar3.Location = new System.Drawing.Point(56, 40);
this.trackBar3.Name = "trackBar3";
this.trackBar3.TabIndex = 3;
this.trackBar3.Scroll += new System.EventHandler(this.trackBar_Scroll);
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.trackBar3)).EndInit();
CType(trackBar1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(trackBar2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(trackBar3, System.ComponentModel.ISupportInitialize).BeginInit()
SuspendLayout()
'
'trackBar1
'
trackBar1.Location = New Point(160, 400)
trackBar1.Name = "trackBar1"
trackBar1.TabIndex = 1
'
'trackBar2
'
trackBar2.Location = New Point(608, 40)
trackBar2.Name = "trackBar2"
trackBar2.TabIndex = 2
'
'trackBar3
'
trackBar3.Location = New Point(56, 40)
trackBar3.Name = "trackBar3"
trackBar3.TabIndex = 3
CType(trackBar1, System.ComponentModel.ISupportInitialize).EndInit()
CType(trackBar2, System.ComponentModel.ISupportInitialize).EndInit()
CType(trackBar3, System.ComponentModel.ISupportInitialize).EndInit()

Remarks

ISupportInitialize allows controls to optimize multiple property assignments. As a result, you can initialize co-dependent properties or batch set multiple properties at design time.

Call the BeginInit method to signal the object that initialization is starting. Call the EndInit method to signal that initialization is complete.

Methods

BeginInit()

Signals the object that initialization is starting.

EndInit()

Signals the object that initialization is complete.

Applies to

See also