1. Add Shockwave Flash Object to Tool Box
2. Register Flash ActiveX Control
3. Use Shockwave Flash Object
1.Add Shockwave Flash Object to Tool Box
2.Register Flash ActiveX
找到Flash9f.ocx的路徑(名稱會依安裝的版本不同而有改變)
一般是放在C:\WINDOWS\system32\Macromed\Flash\
在命令列輸入regsvr32 C:\WINDOWS\system32\Macromed\Flash\Flash9f.ocx
3.Use Shockwave Flash Object
使用Toolbox裡的Shockwave Flash Object
另外當使用Visual Studio做過Register Flash ActiveX的步驟後,托拉Shockwave Flash Object到Form時,如果有下面的錯誤發生:
那需要使用Windows Form ActiveX控制項匯入工具(AxImp.exe)來手動產生dll
1. AxShockwaveFlashObjects.dll
2. ShockwaveFlashObjects.dll
再加入Visual Studio 專案中的參考裡面,再去手動Coding
AxImp.exe 需要安裝過.Net Framework SDK
“C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin” 底下會有AxImp.exe
AxImp.exe 的使用方式
Command-Line: cd C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin
Command-Line: aximp C:\WINDOWS\system32\Macromed\Flash\Flash9f(10a).ocx
程式的配置方式
namespace PA_Project
{
partial class PAParty
{
...
...
private void InitializeComponent()
{
...
...
this.axShockwaveFlash1 = new AxShockwaveFlashObjects.AxShockwaveFlash();
...
...
//
// axShockwaveFlash1
//
this.axShockwaveFlash1.Enabled = true;
this.axShockwaveFlash1.Location = new System.Drawing.Point(-1, 3);
this.axShockwaveFlash1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.axShockwaveFlash1.Name = "axShockwaveFlash1";
this.axShockwaveFlash1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axShockwaveFlash1.OcxState")));
this.axShockwaveFlash1.Size = new System.Drawing.Size(700, 500);
this.axShockwaveFlash1.TabIndex = 3;
...
...
}
...
...
public AxShockwaveFlashObjects.AxShockwaveFlash axShockwaveFlash1;
...
...
}
}
Reference: http://msdn.microsoft.com/zh-tw/library/8ccdh774.aspx
沒有留言:
張貼留言