Sdílet prostřednictvím


ComponentInstaller.CopyFromComponent(IComponent) Metoda

Definice

Při přepsání v odvozené třídě zkopíruje všechny vlastnosti, které jsou požadovány v době instalace ze zadané komponenty.

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

Komponenta, ze které chcete kopírovat.

Příklady

Následující příklad definuje třídu MyInstallClass, která vytvoří protokol událostí a zkopíruje vlastnosti komponenty protokolu událostí do .EventLogInstaller Také zkontrolujeServiceInstaller, jestli může provést stejný typ instalace jako .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)

Poznámky

Instalační program by měl z živé komponenty získat všechny informace, které může, a uložit je pro použití v době instalace.

Platí pro