客户端需要安装framework才能够正确通过浏览器访问windows form控件.
具体使用方法请参见:
http://chs.gotdotnet.com/quickstart/winforms/doc/WinFormsAxHosting.aspx
具体使用方法请参见:
http://chs.gotdotnet.com/quickstart/winforms/doc/WinFormsAxHosting.aspx
解决方案 »
- WEB开发中这种样式该选择哪个控件实现?
- js导出word ,2010word下面这句为什么会出错,new ActiveXObject("Word.Application");
- 请教:关于URL的两个问题,HELP^^^^^^
- Eval绑定后格式化问题
- 求助,Ajax怎么能取其他域名网站的数据?
- 跪求SourceAnyWhere(支持Internet访问的VSS)的配置方法
- 请问 如何在被调用的方法中结束此方法?
- 怎样得到dataset中,一个表的特定行,特定列的值?
- wml中关于table
- 如何从浏览器中网页拖拽一条新闻链接到记事本中显示url,不能复制粘贴等手段,只能拖出来
- 在webform中调用windowsForm控件的问题
- iis服务器安装.net 错误!!!help
或者创建带有object标记的HTML 文档,具体你可以看quickstar
<object id="simpleControl1"
classid="http:SimpleControl.dll#Microsoft.Samples.WinForms.Cs.SimpleControl.SimpleControl"
height="300" width="300" VIEWASTEXT>
<param name="Text" value="Simple Control">
</object>
classid 有两个令人感兴趣的部分:指向控件库的路径和控件的完全限定名,这两者由#号分隔开
但如上所说,客户端也得安装.net framework
Using Windows Forms Controls in Internet Explorer
http://samples.gotdotnet.com/quickstart/winforms/doc/WinFormsIeSourcing.aspx
Com组件:Microsoft Forms 2.0 listbox,接下来应该怎样做呢?
添加一个用户控件,在上面放一个winform的ListBox,做其他你需要的设置
编译为dll
到web项目中,在aspx页中加入<object id= classid=……
异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。
请各位帮忙!
分析器错误信息: GUID 应包含带 4 个短划线的 32 位数 (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)。
Imports System
Imports System.Windows.Forms
Namespace web_control
Public Class UserControl1
Inherits System.Windows.Forms.UserControl#Region " Windows 窗体设计器生成的代码 " Public Sub New()
MyBase.New() '该调用是 Windows 窗体设计器所必需的。
InitializeComponent() '在 InitializeComponent() 调用之后添加任何初始化 End Sub 'UserControl1 重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub 'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer '注意:以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents ListBox1 As System.Windows.Forms.ListBox
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.ListBox1 = New System.Windows.Forms.ListBox()
Me.SuspendLayout()
'
'ListBox1
'
Me.ListBox1.HorizontalExtent = 5000
Me.ListBox1.HorizontalScrollbar = True
Me.ListBox1.ItemHeight = 12
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.Size = New System.Drawing.Size(144, 76)
Me.ListBox1.TabIndex = 0
'
'UserControl1
'
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.ListBox1})
Me.Name = "UserControl1"
Me.Size = New System.Drawing.Size(152, 80)
Me.ResumeLayout(False) End Sub#End Region Private Sub UserControl1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListBox1.Items.Insert(0, "asdfasfasdfsdafasdfasfasdfsdfasdfasdfasdfa")
ListBox1.Items.Insert(1, "sdfsdafsadfsdafksafjasfkjfksjfjasfjsadjfkjsdfjsddf")
End Sub
End Class
End Namespace
<%@ Page Language="vb" debug="true" AutoEventWireup="false" src="test.aspx.vb" Codebehind="test.aspx.vb" Inherits="_192._168._10._202.test" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>test</title>
<META content="Microsoft Visual Studio .NET 7.0" name="GENERATOR">
<META content="Visual Basic 7.0" name="CODE_LANGUAGE">
<META content="JavaScript" name="vs_defaultClientScript">
<META content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<BODY MS_POSITIONING="GridLayout">
<FORM id="Form1" method="post" runat="server">
<FONT face="宋体">
<OBJECT id="listbox1" style="Z-INDEX: 101; LEFT: 0px; WIDTH: 500px; POSITION: absolute; TOP: 0px; HEIGHT: 100px" classid="http:\bin\web_listbox.dll#System.Windows.Forms.UserControl.UserControl1" VIEWASTEXT>
</OBJECT>
</FONT></FONT></FORM>
</BODY>
</HTML>这是Codebehind的代码:
Imports System
Imports System.Windows
Imports System.Windows.Forms.Form
Public Class test
Inherits System.Web.UI.Page
Protected WithEvents listbox1 As System.Windows.Forms.ListBox
#Region " Web 窗体设计器生成的代码 " '该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub#End Region Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
ListBox1.Items.Insert(0, "asdfsdafsdfasdfdsafsdfasdfsdafasdfasfsdfasdfasdfasdfasdfasdfasdfasfsdafsadfsadfsdafsdafasdfasdfsd")
ListBox1.Items.Insert(1, "sfshfsjfjsafjsadff")
ListBox1.Items.Insert(2, "sdafsdafsadfjsdafjsjfjasdfkasjfkjasdfjkasdjfsjafjasfjasjfjasdkfjsajsadfjask")
ListBox1.HorizontalExtent = 50000
ListBox1.HorizontalScrollbar = True
End SubEnd Class请大哥真的要帮小弟这个忙!
我生成了一个,也可以添加到Web页上
不知道这句话你是怎么加上去的
Protected WithEvents listbox1 As System.Windows.Forms.ListBox
我估计问题的原因应该是这样
这个控件并不是runat=server的,因而不能在CodeBehind里调用
但可以用脚本,这是quickstart的原话:若要获取对控件的编程访问,可以针对该控件编写脚本。
它的例子也仅仅是用脚本控制
其实你要实现什么交互功能,完全可以在设计控件时给控件加上,WinForm里总比WebForm要好使用吧:)