新聞中心
C#語言還是比較常見的東西,這里我們主要介紹C#編寫ActiveX控件,包括介紹建立一個WinForm控件項目HelloWorld等方面。

目前累計服務(wù)客戶上千多家,積累了豐富的產(chǎn)品開發(fā)及服務(wù)經(jīng)驗。以網(wǎng)站設(shè)計水平和技術(shù)實力,樹立企業(yè)形象,為客戶提供網(wǎng)站制作、成都網(wǎng)站制作、網(wǎng)站策劃、網(wǎng)頁設(shè)計、網(wǎng)絡(luò)營銷、VI設(shè)計、網(wǎng)站改版、漏洞修補等服務(wù)。創(chuàng)新互聯(lián)建站始終以務(wù)實、誠信為根本,不斷創(chuàng)新和提高建站品質(zhì),通過對領(lǐng)先技術(shù)的掌握、對創(chuàng)意設(shè)計的研究、對客戶形象的視覺傳遞、對應(yīng)用系統(tǒng)的結(jié)合,為客戶提供更好的一站式互聯(lián)網(wǎng)解決方案,攜手廣大客戶,共同發(fā)展進步。
前些日子做一個Web項目,必須自己編寫一個ActiveX控件。如今的ActiveX控件大多是使用VB/C++來開發(fā)的,而我對他們并不熟悉,因此考慮使用熟悉的C#編寫ActiveX控件。
首先,建立一個WinForm控件項目HelloWorld,并拖入一個Label控件,文字設(shè)為HelloWorld
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Windows.Forms;
- namespace HelloWorld
- {
- /**////
- /// UserControl1 的摘要說明。
- ///
- public class Demo : System.Windows.Forms.UserControl
- {
- private System.Windows.Forms.Label label1;
- /**////
- /// 必需的設(shè)計器變量。
- ///
- private System.ComponentModel.Container components = null;
- public Demo()
- {
- // 該調(diào)用是 Windows.Forms 窗體設(shè)計器所必需的。
- InitializeComponent();
- // TODO: 在 InitComponent 調(diào)用后添加任何初始化
- }
- /**////
- /// 清理所有正在使用的資源。
- ///
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if( components != null )
- components.Dispose();
- }
- base.Dispose( disposing );
- }
- 組件設(shè)計器生成的代碼#region 組件設(shè)計器生成的代碼
- /**////
- /// 設(shè)計器支持所需的方法 - 不要使用代碼編輯器
- /// 修改此方法的內(nèi)容。
- ///
- private void InitializeComponent()
- {
- this.label1 = new System.Windows.Forms.Label();
- this.SuspendLayout();
- //
- // label1
- //
- this.label1.Location = new System.Drawing.Point(32, 32);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(120, 32);
- this.label1.TabIndex = 0;
- this.label1.Text = "HelloWorld";
- this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // Demo
- //
- this.Controls.Add(this.label1);
- this.Name = "Demo";
- this.Size = new System.Drawing.Size(184, 96);
- this.ResumeLayout(false);
- }
- #endregion
- }
- }
不過,C#編寫ActiveX控件的任務(wù)還沒有完成。我們還沒有實現(xiàn)腳本互動或者讀寫I/O,也沒有實現(xiàn)ActiveX控件的自動分發(fā)。在下一篇Blog中,我會完成ActiveX控件的編寫。
本文題目:C#編寫ActiveX控件詳細(xì)介紹
文章位置:http://www.fisionsoft.com.cn/article/djcohhe.html


咨詢
建站咨詢
