c# 开发activex (已经在系统注册 regasm )在vc 6.0 调用 可以再vc 里面看到控件 但是 不能添加变量 报 the activex control is not registered properly 有谁遇到这样得问题?
解决方案 »
- c# 鼠标在用户控件中的位置
- 急求求积分的函数
- Regex 的使用问题 ,高手请进,速度结帖!~~
- winform中如何实现类似webform中的导航功能?
- 用.NET做监控SQL服务器提问
- 这是第三张同样的帖子,请大家救救俺吧¥%……¥%……#¥#¥%*&&&^&%%$%##$#
- 怎么样遍历系统的菜单
- 财鸟请教:try {} catch 语句的问题?
- 我在用.NET自带的测试工具ACT对Web 服务器进行性能测试,查看测试结果的时候,发现提示当前脚本错误,错误类型是对象不支持该属性和方法
- 在线请教:用C#如何创建INI文件啊??
- 求正则表达式,或正则表达式工具,在线等着~~~~~~
- 编译器不认识相对路径?
17 Guid("627AD403-FA50-4a08-B875-770520865DD6"),
31 ClassInterface(ClassInterfaceType.None),
40 ComVisible(true)
41 ]
42 public partial class yourclass{...}每次修改之后需要重新注册。
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using Microsoft.Win32;
using System.Reflection;
namespace ClassLibrary2
{
[Guid("7B5F5BA2-0EAE-4351-AE55-B24C63C1ACDD")]
public interface Iuser
{
void msg();
} [ProgId("testttttttt")]
[Guid("6E5DB382-61E6-4b07-9ABC-43EC54FCE810")]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
public partial class TestCom : UserControl
{
public TestCom()
{
InitializeComponent();
} private void button1_Click(object sender, EventArgs e)
{
this.BackColor = Color.Red;
} private void msg()
{
MessageBox.Show("this is a test");
}
}
}
AssemblyInfo.cs 设置了[assembly: ComVisible(true)] 不能添加变量 vc 6.0 mfc 类向导 添加控件变量 因为vc 中 控件显示ID 必须将该ID 与类型映射 所以添加变量
现在得情况是控件已经托到窗体了,但是就是无法添加变量
using Microsoft.Win32; // RegistryKey
using System.Windows.Forms;
using System;
using System.Text;
using System.Reflection;
using System.Drawing;
namespace WindowsControlLibrary1 {
// Stops control from getting a new CLSID
// at each registration
[ProgId("newcontrols")]
[Guid("E73CD054-1247-4853-AF05-B7D26D993E85")]
[ClassInterface(ClassInterfaceType.AutoDispatch)]
public class UserControl2 : UserControl ,Iusercontrol
{
private Button button1;
public void name()
{
} private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(32, 57);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(408, 153);
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// UserControl2
//
this.BackColor = System.Drawing.Color.Brown;
this.Controls.Add(this.button1);
this.Name = "UserControl2";
this.Size = new System.Drawing.Size(518, 328);
this.ResumeLayout(false); } private void button1_Click(object sender, EventArgs e)
{ }
} [Guid("7A4673AD-39E4-4856-876B-4451C5B0EB25")]
public interface Iusercontrol
{
void name(); }
}