关于在网页中插入自定义DLL控件的问题!!!!

efoxy 2003-12-30 02:03:33
我自定义了一个.NET winForm控件编译为一个Dll文件,并定义了一些public属性,然后用<object>标签将此控件嵌入到网页中,想在网页中用利用VBScript对此控件属性进行操作,但执行时却提示该控件没有此属性。如何才能解决?万分感谢。。
...全文
62 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
efoxy 2003-12-31
  • 打赏
  • 举报
回复
加分加错了可以改吗?
saucer 2003-12-30
  • 打赏
  • 举报
回复
it works fine with me on localhost

1. did you see the button/label displayed in the browser?
2. what browser are you using?
caoit 2003-12-30
  • 打赏
  • 举报
回复
学习
efoxy 2003-12-30
  • 打赏
  • 举报
回复
up
saucer 2003-12-30
  • 打赏
  • 举报
回复
1. how are you accessing the control? show some code?

2. make sure you properly configured the permissions, see
http://windowsforms.net/articles/iesourcing.aspx
chang1216 2003-12-30
  • 打赏
  • 举报
回复
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>新建网页 1</title>
<script language=vbscript>
sub bg()
test.width=500 '这行可以工作
test.TitleNew=" has been clear." '这里提示错误,TitleNew为自定义属性
end sub
</script>
</head>

<body>
<object id="test" classid="http:DllTest.dll#DllTest.TestDll" width="150" height="150">
</object>
<form method="POST" action="--WEBBOT-SELF--">
<p><input type="button" value="按钮" onclick="bg()" name="B3"></p>
</form>
</body>
</html>

上面是调用的网页

以下为测试控件的原码:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace DllTest
{
/// <summary>
/// UserControl1 的摘要说明。
/// </summary>
public class TestDll : System.Windows.Forms.UserControl
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;

public TestDll()
{
// 该调用是 Windows.Forms 窗体设计器所必需的。
InitializeComponent();

// TODO: 在 InitComponent 调用后添加任何初始化

}

/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
}

#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器
/// 修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(32, 64);
this.button1.Name = "button1";
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label1
//
this.label1.Location = new System.Drawing.Point(24, 16);
this.label1.Name = "label1";
this.label1.TabIndex = 1;
this.label1.Text = "the title";
//
// TestDll
//
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
this.Name = "TestDll";
this.ResumeLayout(false);

}
#endregion

private void button1_Click(object sender, System.EventArgs e)
{
if(this.BackColor==Color.Blue)
this.BackColor=System.Drawing.Color.Red;
else
this.BackColor=Color.Blue;
}

public string TitleNew
{
get
{
return this.label1.Text;
}
set
{
this.label1.Text=value;
}
}

}
}


控件在网页中可以正确显示,且控件中的按钮工作正常,网页中的按钮在点击时,对于控件的自有属性可以工作(改变控件宽度),但自定义属性却无法工作,提示“控件不支持此属性或方法”
efoxy 2003-12-30
  • 打赏
  • 举报
回复
up

62,025

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧