2012-03-02 21 views

答えて

1

COMは視覚的な側面を持つ必要はないので、私はあなたがActiveXコントロールを意味すると思います。ここにMicrosoftのMSDNからのウォークスルーへのリンクがあります。 Windows.Formsの統合を使用すること

Walkthrough: Hosting an ActiveX Control in WPF

彼らの例。

private void Window_Loaded(object sender, RoutedEventArgs e) 
{ 
    // Create the interop host control. 
    System.Windows.Forms.Integration.WindowsFormsHost host = 
     new System.Windows.Forms.Integration.WindowsFormsHost(); 

    // Create the ActiveX control. 
    AxWMPLib.AxWindowsMediaPlayer axWmp = new AxWMPLib.AxWindowsMediaPlayer(); 

    // Assign the ActiveX control as the host control's child. 
    host.Child = axWmp; 

    // Add the interop host control to the Grid 
    // control's collection of child controls. 
    this.grid1.Children.Add(host); 

    // Play a .wav file with the ActiveX control. 
    axWmp.URL = @"C:\Windows\Media\tada.wav"; 
} 
1

にWindowsFormsHostを使用してWPFにCOMコントロールを追加するのは簡単です。 しかし、WindowsFormsHostを使ってZIndexを設定することができないという問題は、常にページの上部に表示されます。

関連する問題