ComponentInstaller.CopyFromComponent(IComponent) Metoda

Definicja

Po zastąpieniu w klasie pochodnej program kopiuje wszystkie właściwości wymagane w czasie instalacji z określonego składnika.

public:
 abstract void CopyFromComponent(System::ComponentModel::IComponent ^ component);
public abstract void CopyFromComponent (System.ComponentModel.IComponent component);
abstract member CopyFromComponent : System.ComponentModel.IComponent -> unit
Public MustOverride Sub CopyFromComponent (component As IComponent)

Parametry

component
IComponent

Składnik do skopiowania.

Przykłady

W poniższym przykładzie zdefiniowano klasę MyInstallClass, która tworzy dziennik zdarzeń i kopiuje właściwości składnika dziennika zdarzeń do klasy EventLogInstaller. Sprawdza również, czy ServiceInstaller program może wykonać taką samą instalację, jak w przypadku programu EventLogInstaller.

EventLogInstaller^ myEventLogInstaller = gcnew EventLogInstaller;
// Create a source for the specified event log, on local computer.
EventLog::CreateEventSource( "MyEventSource", "MyEventLog", "." );
// Create an event log instance and associate it with the log .
EventLog^ myEventLog = gcnew EventLog( "MyEventLog",".","MyEventSource" );
// Copy the properties that are required at install time from
// the event log component to the installer.
myEventLogInstaller->CopyFromComponent( myEventLog );
EventLogInstaller myEventLogInstaller = new EventLogInstaller();
// Create a source for the specified event log, on local computer.
EventLog.CreateEventSource("MyEventSource","MyEventLog", ".");
// Create an event log instance and associate it with the log .
EventLog myEventLog = new EventLog("MyEventLog", ".", "MyEventSource");
// Copy the properties that are required at install time from
// the event log component to the installer.
myEventLogInstaller.CopyFromComponent(myEventLog);
Dim myEventLogInstaller As New EventLogInstaller()
' Create a source for the specified event log, on local computer.
EventLog.CreateEventSource("MyEventSource", "MyEventLog", ".")
' Create an event log instance and associate it with the log .
Dim myEventLog As New EventLog("MyEventLog", ".", "MyEventSource")
' Copy the properties that are required at install time from
' the event log component to the installer.
myEventLogInstaller.CopyFromComponent(myEventLog)

Uwagi

Instalator powinien pobrać wszystkie informacje, które mogą pochodzić ze składnika na żywo i przechowywać je do użycia w czasie instalacji.

Dotyczy