全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:3450
推到 Plurk!
推到 Facebook!

【#Develop】如何引用 ActiveX 元件並加入表單中

答題得分者是:qoo1234
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-08-27 13:45:20 IP:220.139.xxx.xxx 未訂閱
感謝 qoo1234 版主推薦的 #develop http://delphi.ktop.com.tw/topic.php?TOPIC_ID=54148 可以讓大家玩玩 C#  最近在試用的過程,發現從右邊 href="http://dllee.ktop.com.tw" target="blank">吃軟也吃硬 dllee.ktop.com.tw 視動科技 VMASK - ViewMove Automation Software Kernel 發表人 - dllee 於 2004/08/27 13:51:28
------
http://www.ViewMove.com
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-08-27 15:19:43 IP:220.131.xxx.xxx 未訂閱
引用 ActiveX 元件並加入表單中..兩種玩法  (AxImp.exe 和 註冊到GAC) ============================================= ActiveX 元件的兩種使用方式:    1.AxImp.exe轉換COM為NET視覺元件 (AxImp.exe:.NET framework SDK安裝後有提供!) 批次檔執行範例如下: aximp c:\windows\system32\wmp.dll /out:Interop.wmp.dll pause 完成後,可在工具按右鍵 -->選擇configuresidebar(引用項目設定)-->選擇存放元件分類位置-->新增元件-->自訂-->選擇Interop.wmp.dll-->確定 --------------------------------------------------------------- 2.開發工具加入COM為「參考( References )」時,為非視覺元件使用方式。 網海無涯,唯學是岸! 發表人 - qoo1234 於 2004/08/27 15:52:49
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-08-27 15:22:25 IP:220.131.xxx.xxx 未訂閱
Windows MediaPlayer操作範例-收音機製作
(Windows MediaPlayer採用非視覺方式製作-加入「參考」方式)
程式碼如下:
/*
 * 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
 * 作    者: 
 * 建立日期: 2004/8/25
 * 建立時間: 下午 08:05
 * 功    能: 
 * 修改日期: 2004/8/25 下午 08:05
 */
using System;
using System.Windows.Forms;
using System.ComponentModel;
using WMPLib;
namespace DefaultNamespace
{
 /// 
 /// Description of MainForm. 
 /// 
 public class MainForm : System.Windows.Forms.Form
 {
  private ColorButton.ColorButton colorButton2;
  private ColorButton.ColorButton colorButton1;
  private System.Windows.Forms.ListBox listBox1;
  private WMPLib.WindowsMediaPlayer Paly=new WindowsMediaPlayer();
  private System.ComponentModel.Container components = null;
 
  public MainForm()
  {
   //
   // The InitializeComponent() call is required for Windows Forms designer support.
   //
   InitializeComponent();
   
   //
   // TODO: Add constructor code after the InitializeComponent() call.
   //
  }
  
  [STAThread]
  public static void Main(string[] args)
  {
   Application.Run(new MainForm());
  }
  /// 
  /// components Free
  /// 
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
     if (components != null) 
     {
      components.Dispose();
     }
   }
   base.Dispose( disposing );
  }
  
  #region Windows Forms Designer generated code
  /// 
  /// This method is required for Windows Forms designer support.
  /// Do not change the method contents inside the source code editor. The Forms designer might
  /// not be able to load this method if it was changed manually.
  /// 
  private void InitializeComponent() {
   this.listBox1 = new System.Windows.Forms.ListBox();
   this.colorButton1 = new ColorButton.ColorButton();
   this.colorButton2 = new ColorButton.ColorButton();
   this.SuspendLayout();
   // 
   // listBox1
   // 
   this.listBox1.ItemHeight = 12;
   this.listBox1.Items.AddRange(new object[] {
      "mms://live.media.hinet.net/UFO_Music1",
      "mms://live.media.hinet.net/kissradio ",
      "mms://live.media.hinet.net/vot "});
   this.listBox1.Location = new System.Drawing.Point(8, 8);
   this.listBox1.Name = "listBox1";
   this.listBox1.Size = new System.Drawing.Size(272, 64);
   this.listBox1.TabIndex = 1;
   this.listBox1.Click  = new System.EventHandler(this.listBox1Click);
   // 
   // colorButton1
   // 
   this.colorButton1.Active = true;
   this.colorButton1.ButtonStyle = ColorButton.ColorButton.ButtonStyles.Rectangle;
   this.colorButton1.Font = new System.Drawing.Font("Verdana", 10F, System.Drawing.FontStyle.Bold);
   this.colorButton1.GradientStyle = ColorButton.ColorButton.GradientStyles.Vertical;
   this.colorButton1.HoverBorderColor = System.Drawing.Color.MediumVioletRed;
   this.colorButton1.HoverColorA = System.Drawing.Color.MediumVioletRed;
   this.colorButton1.HoverColorB = System.Drawing.Color.White;
   this.colorButton1.Location = new System.Drawing.Point(8, 80);
   this.colorButton1.Name = "colorButton1";
   this.colorButton1.NormalBorderColor = System.Drawing.Color.Green;
   this.colorButton1.NormalColorA = System.Drawing.Color.Green;
   this.colorButton1.NormalColorB = System.Drawing.Color.Honeydew;
   this.colorButton1.Size = new System.Drawing.Size(64, 32);
   this.colorButton1.SmoothingQuality = ColorButton.ColorButton.SmoothingQualities.AntiAlias;
   this.colorButton1.TabIndex = 2;
   this.colorButton1.Text = "播放";
   this.colorButton1.Click  = new System.EventHandler(this.ColorButton1Click);
   // 
   // colorButton2
   // 
   this.colorButton2.Active = true;
   this.colorButton2.ButtonStyle = ColorButton.ColorButton.ButtonStyles.Rectangle;
   this.colorButton2.Font = new System.Drawing.Font("Verdana", 10F, System.Drawing.FontStyle.Bold);
   this.colorButton2.GradientStyle = ColorButton.ColorButton.GradientStyles.Vertical;
   this.colorButton2.HoverBorderColor = System.Drawing.Color.MediumVioletRed;
   this.colorButton2.HoverColorA = System.Drawing.Color.MediumVioletRed;
   this.colorButton2.HoverColorB = System.Drawing.Color.White;
   this.colorButton2.Location = new System.Drawing.Point(80, 80);
   this.colorButton2.Name = "colorButton2";
   this.colorButton2.NormalBorderColor = System.Drawing.Color.Green;
   this.colorButton2.NormalColorA = System.Drawing.Color.Green;
   this.colorButton2.NormalColorB = System.Drawing.Color.Honeydew;
   this.colorButton2.Size = new System.Drawing.Size(64, 32);
   this.colorButton2.SmoothingQuality = ColorButton.ColorButton.SmoothingQualities.AntiAlias;
   this.colorButton2.TabIndex = 3;
   this.colorButton2.Text = "停止";
   this.colorButton2.Click  = new System.EventHandler(this.ColorButton2Click);
   // 
   // MainForm
   // 
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
   this.ClientSize = new System.Drawing.Size(296, 126);
   this.Controls.Add(this.colorButton2);
   this.Controls.Add(this.colorButton1);
   this.Controls.Add(this.listBox1);
   this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
   this.MaximizeBox = false;
   this.Name = "MainForm";
   this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
   this.Text = "簡易收音機";
   this.ResumeLayout(false);
  }
  #endregion    
  
  void listBox1Click(object sender, System.EventArgs e)
  {
    Paly.URL=listBox1.SelectedItem.ToString();       
  }  
  
  void ColorButton1Click(object sender, System.EventArgs e)
  {
      if (listBox1.SelectedItem.ToString().Length>0)
   {
    Paly.controls.play();
   } 
  }
  
  void ColorButton2Click(object sender, System.EventArgs e)
  {
   Paly.controls.stop();
  }
  
 }
}
 
網海無涯,唯學是岸! 發表人 - qoo1234 於 2004/08/27 15:46:04
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-08-27 15:26:38 IP:220.131.xxx.xxx 未訂閱
 /*
 * 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
 * 作    者: 
 * 建立日期: 2004/8/25
 * 建立時間: 下午 10:57
 * 功    能: 收音機(轉換COM為.NET視覺化元件方式)
 * 修改日期: 2004/8/25 下午 10:57
 */
using System;
using System.Windows.Forms;    namespace DefaultNamespace
{
        /// 
        /// Description of MainForm.        
        /// 
        public class MainForm : System.Windows.Forms.Form
        {
                private System.Windows.Forms.ListBox listBox1;
                private mdobler.XPCommonControls.XPGradientPanel xPGradientPanel1;
                private AxWMPLib.AxWindowsMediaPlayer axWindowsMediaPlayer1;
                public MainForm()
                {
                        //
                        // The InitializeComponent() call is required for Windows Forms designer support.
                        //
                        InitializeComponent();
                        
                        //
                        // TODO: Add constructor code after the InitializeComponent() call.
                        //
                }
                
                [STAThread]
                public static void Main(string[] args)
                {
                        Application.Run(new MainForm());
                }
                
                #region Windows Forms Designer generated code
                /// 
                /// This method is required for Windows Forms designer support.
                /// Do not change the method contents inside the source code editor. The Forms designer might
                /// not be able to load this method if it was changed manually.
                /// 
                private void InitializeComponent() {
                        System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MainForm));
                        this.axWindowsMediaPlayer1 = new AxWMPLib.AxWindowsMediaPlayer();
                        this.xPGradientPanel1 = new mdobler.XPCommonControls.XPGradientPanel();
                        this.listBox1 = new System.Windows.Forms.ListBox();
                        ((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).BeginInit();
                        this.xPGradientPanel1.SuspendLayout();
                        this.SuspendLayout();
                        // 
                        // axWindowsMediaPlayer1
                        // 
                        this.axWindowsMediaPlayer1.ContainingControl = this;
                        this.axWindowsMediaPlayer1.Dock = System.Windows.Forms.DockStyle.Fill;
                        this.axWindowsMediaPlayer1.Enabled = true;
                        this.axWindowsMediaPlayer1.Location = new System.Drawing.Point(216, 0);
                        this.axWindowsMediaPlayer1.Name = "axWindowsMediaPlayer1";
                        this.axWindowsMediaPlayer1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("axWindowsMediaPlayer1.OcxState")));
                        this.axWindowsMediaPlayer1.Size = new System.Drawing.Size(336, 246);
                        this.axWindowsMediaPlayer1.TabIndex = 0;
                        // 
                        // xPGradientPanel1
                        // 
                        this.xPGradientPanel1.Controls.Add(this.axWindowsMediaPlayer1);
                        this.xPGradientPanel1.Controls.Add(this.listBox1);
                        this.xPGradientPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
                        this.xPGradientPanel1.Location = new System.Drawing.Point(0, 0);
                        this.xPGradientPanel1.Name = "xPGradientPanel1";
                        this.xPGradientPanel1.Size = new System.Drawing.Size(552, 246);
                        this.xPGradientPanel1.TabIndex = 1;
                        // 
                        // listBox1
                        // 
                        this.listBox1.Dock = System.Windows.Forms.DockStyle.Left;
                        this.listBox1.ItemHeight = 12;
                        this.listBox1.Items.AddRange(new object[] {
                                                "mms://live.media.hinet.net/UFO_Music1 ",
                                                "mms://live.media.hinet.net/kissradio ",
                                                "mms://live.media.hinet.net/vot "});
                        this.listBox1.Location = new System.Drawing.Point(0, 0);
                        this.listBox1.Name = "listBox1";
                        this.listBox1.Size = new System.Drawing.Size(216, 244);
                        this.listBox1.TabIndex = 1;
                        this.listBox1.Click  = new System.EventHandler(this.listBox1Click);
                        // 
                        // MainForm
                        // 
                        this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
                        this.ClientSize = new System.Drawing.Size(552, 246);
                        this.Controls.Add(this.xPGradientPanel1);
                        this.Name = "MainForm";
                        this.Text = "MainForm";
                        ((System.ComponentModel.ISupportInitialize)(this.axWindowsMediaPlayer1)).EndInit();
                        this.xPGradientPanel1.ResumeLayout(false);
                        this.ResumeLayout(false);
                }
                #endregion
                
                void listBox1Click(object sender, System.EventArgs e)
                {
                         axWindowsMediaPlayer1.URL=listBox1.SelectedItem.ToString();                     
                }        
        }
}    
網海無涯,唯學是岸!
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-08-27 15:29:25 IP:220.131.xxx.xxx 未訂閱
SharpDevelop RC2/RC3的BUG注意:
 
1.「AxImp.exe轉換COM元件」為NET視覺元件,使用時,
     視窗設計與程式碼編輯器切換,會造成「NET視覺元件」,
     被移除現象。
     解決方式:不儲存,關閉專案,在開啟。
                         若切換至程式碼編輯器,則會被修改,無該視覺元件。
 
2.「AxImp.exe轉換COM元件」為NET視覺元件安裝後,
     因SharpDevelop RC2開啟新專案或SharpDevelop RC2關閉,
     找不到NET視覺元件的錯誤訊息出現。
    解決方式:
    (a)輕微:SharpDevelop RC2關閉,再開啟即可。
    (b)持續錯誤:SharpDevelop RC2開啟元件管理,移除元件後,
                            關閉 SharpDevelop RC2,再開啟。
                             (表示該元件,建議不以視覺化元件方式使用!)
 
網海無涯,唯學是岸!
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#6 引用回覆 回覆 發表時間:2004-08-27 20:32:25 IP:211.76.xxx.xxx 未訂閱
再小問一下,是否一定要安裝 .NET SDK 才能使 #Develop 加入COM為「參考( References )」? 因為我加入時,都會出現警告視窗,說(我自己翻的 ) <>這個 > 但是那個 href="http://dllee.ktop.com.tw" target="blank">吃軟也吃硬 dllee.ktop.com.tw 視動科技 VMASK - ViewMove Automation Software Kernel
------
http://www.ViewMove.com
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#7 引用回覆 回覆 發表時間:2004-08-27 21:12:34 IP:220.131.xxx.xxx 未訂閱
#Develop (無內建.NET Framework相關程式 )    VC#(內建.NET Framework相關程式 )    這就是原廠與副廠的差別~ 所以安裝 src="http://delphi.ktop.com.tw/download/upload\33223_qoo.gif">網海無涯,唯學是岸!
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#8 引用回覆 回覆 發表時間:2004-08-27 21:47:17 IP:220.131.xxx.xxx 未訂閱
#develop 它的安裝說明: Installation    *Install the .NET SDK or runtime. SDK is preferred though. (或是可以測試這兩種差異) .NET Framework SDK Version 1.1 (用於開發人員) http://www.microsoft.com/downloads/details.aspx?FamilyId=9B3A2CA6-3647-4070-9F41-A333C6B9181D&displaylang=en 或 Microsoft .NET Framework 1.1 可轉散佈品(執行時期的SDK,用於客戶端) http://www.microsoft.com/downloads/details.aspx?FamilyId=262D25E3-F589-4842-8157-034D1E7CF3A3&displaylang=en *Copy the SharpDevelop distribution to a directory of your choice *Run SharpDevelop.exe in the installation \bin directory *You can make your own link to SharpDevelop on your desktop *If you have a previous version installed, please delete the “.ICSharpCode” directory in the user's application data folder. 網海無涯,唯學是岸!
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#9 引用回覆 回覆 發表時間:2004-08-30 13:28:56 IP:220.139.xxx.xxx 未訂閱
使用「AxImp.exe轉換COM元件」為NET視覺元件,在使用 AxImp.exe 轉完後, 加入 #Develop 的專案,立刻關閉 #Develop,再開,可以看到元件, 有的也可以正常加入表單內並使用。 但有的在加入時會出現: ActiveX controls accept only Fonts that are defined in GraphicsUnit.Point. Parameter name: font 的錯誤訊息視窗,在有裝 .NET SDK 下也是一樣... 這樣有解嗎?
------
http://www.ViewMove.com
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#10 引用回覆 回覆 發表時間:2004-08-30 15:38:07 IP:220.131.xxx.xxx 未訂閱
dllee前輩你好,BUG同樓上所說「SharpDevelop RC2/RC3的BUG注意」 其他問題,可以到此先問問看: http://www.icsharpcode.net/OpenSource/SD/Forum/forum.asp?FORUM_ID=25    或 Windows Forms ActiveX Control Importer (Aximp.exe) http://msdn.microsoft.com/library/en-us/cptools/html/cpgrfWindowsFormsActiveXControlImporterAximpexe.asp    或 Cannot Add ActiveX Control to Toolbox http://support.microsoft.com/default.aspx?scid=kb;en-us;320780    BUG的處理,我也在學習中,或者你可以先看看它的原始碼,再找資料看看! 該網站的#D原始碼,可用#D開啟... http://www.icsharpcode.net/OpenSource/SD/    好厲害的玩法!#D自己寫自己#D... < src="http://delphi.ktop.com.tw/download/upload\33223_qoo.gif">網海無涯,唯學是岸! 發表人 - qoo1234 於 2004/08/30 16:28:11 發表人 - qoo1234 於 2004/08/30 16:37:40
dllee
站務副站長


發表:321
回覆:2519
積分:1711
註冊:2002-04-15

發送簡訊給我
#11 引用回覆 回覆 發表時間:2004-08-30 20:47:11 IP:211.76.xxx.xxx 未訂閱
感謝 Qoo1234 版主提供資訊。 這個問題在 #Develop 的討論區也有人問: http://www.icsharpcode.net/opensource/sd/forum/topic.php?TOPIC_ID=6217 但似乎沒有人回應 < > 再次感謝您的協助。 期待您的大作... < > StatPlus2 視動科技 VMASK - ViewMove Automation Software Kernel 發表人 - dllee 於 2004/08/30 20:48:24
------
http://www.ViewMove.com
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#12 引用回覆 回覆 發表時間:2004-08-31 00:17:24 IP:220.131.xxx.xxx 未訂閱
I'm trying to use Steema Software's TeeChart 5 ActiveX control in SharpDevelop. This product ships with strongly signed ActiveX wrappers for the ActiveX control which I've installed into the GAC...    GAC玩法比較複雜: sn -k Qoo.snk tlbimp Qoo.dll /keyfile:Qoo.snk  gacutil -I Qoo.dll <--失敗的話..還要用ildasm做Key的修改 pause    關於TeeChart 5 不知道是不是「TeeChart for .NET」版 有修改過.. 所以TeeChart 5 不支援.NET。    希望玩VC#的高手..測試看看「TeeChart 5」是否可以正常使用...    網海無涯,唯學是岸! 發表人 - qoo1234 於 2004/08/31 00:43:41
系統時間:2024-05-21 13:27:17
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!