ComponentInstaller.CopyFromComponent(IComponent) Metodo

Definizione

Quando sottoposto a override in una classe derivata, copia tutte le proprietà richieste in fase di installazione dal componente specificato.When overridden in a derived class, copies all the properties that are required at install time from the specified component.

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)

Parametri

component
IComponent

Il componente da cui copiare.The component to copy from.

Esempi

Nell'esempio seguente viene definita una MyInstallClassclasse che crea il registro eventi e copia le proprietà del componente del registro eventi EventLogInstallerin.The following example defines a class MyInstallClass, which creates the event log and copies the properties of the event log component to the EventLogInstaller. Controlla inoltre se ServiceInstaller può eseguire lo stesso tipo di installazione EventLogInstallerdel.It also checks whether the ServiceInstaller can perform the same kind of installation as the 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)

Commenti

Il programma di installazione deve prendere tutte le informazioni che possono essere dal componente attivo e archiviarle per l'uso in fase di installazione.The installer should take all the information it can from the live component, and store it for use at install time.

Si applica a