易截截图软件、单文件、免安装、纯绿色、仅160KB

C#编写Com组件

1、新建一个类库项目
2、将Class1.cs改为我们想要的名字
问是否同时给类改名,确定
3、修改Properties目录下面的AssemblyInfo.cs
ComVisible属性设置为True
4、项目菜单->MyLib属性
找到“生成”选项卡
往下看,找到“为 COM Interop 注册”勾上
5、继续往下,找到“签名”选项卡
  勾上“为程序集签名”
  在下面的下拉框里面选择“ <新建...>”
6、在弹出的对话框里面,输入MyLib。。或者随便取个名字
  去掉使用密码保护文件的选项
7、开始编码,任何一个公开的类,必须有一个 I开通的接口定义
C# code
 
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
 
namespace MyLib
{
    [ComVisible(true)]
    [Guid("2CBD3D76-35F1-4f9d-9C1B-9DBFEE412F76")]
    public interface IMyClass
    {
        void Initialize();
        void Dispose();
        int Add(int x, int y);
    }
    [ComVisible(true)]
    [Guid("EA2F140A-108F-47ae-BBD5-83EEE646CC0D")]
    [ProgId("MyLib.MyClass")]
    public class MyClass : IMyClass
    {
        public void Initialize()
        {
            //nothing todo
        }
        public void Dispose()
        {
            //nothing todo
        }
        public int Add(int x, int y)
&


相关文档:

C#一次连接数据库执行多条sql语句(三种方法)

第一种方法:
            string str="server=.;uid=sa;pwd=111111;database=text_db";//连接字符串
            SqlConnection SCON = null;//连接对象
       &n ......

c#操作access*转载

 
 
public static class AccessHelper
{
//数据库连接字符串
//WebForm
//public static readonly string conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + HttpContext.Current.Request.PhysicalApplicationPath + System.Configuration.ConfigurationManager ......

数据交换学习二:asp.net C# 对 sqlserver表的操作

using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Data.SqlClient; ......

C#绘制圆角窗体

public   void   SetWindowRegion()    
  {    
 
System.Drawing.Drawing2D.GraphicsPath   FormPath;    
  FormPath   =
  new   System.Drawing.Drawing2D.GraphicsPath();    
  Rectangle  
rect=ne ......

C# 获取当前是星期几的两种方法

C#的功能很强大,却没有直接提供面向汉字文化的开发倾向
比如我现在要说的获取当前的星期我提供两种方法:
①,DateTime.Now.DayOfWeek ,查询MSDN可以知道该属性返回的结果是:
//
        // 摘要:
        //     获取 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号