如何在Web ASP.NET C#中托管Windows窗体应用程序
问题描述:
我创建了一个Windows窗体用户控件,我需要把它放在一个网页中,为此我使用< object>在网络表单中打开网页中的窗体控件。
我尝试过:
Hi,
I have created one Windows Form User Control and I need to put it in a Web page, for that i using <object> in web form to open the windows form control in web page.
What I have tried:
what i have done is create a windows form user control, take the dll and paste it in the root of the web application project. then load the web application, its not showing the user control which i have created in windows form, just show a frame i the internet explorer.
this is my windows form control..
<pre>[ComVisible(true)]
public partial class UsercontrolTest : UserControl
{
private System.ComponentModel.Container components = null;
public UsercontrolTest()
{
InitializeComponent();
}
}
aspx页面..
aspx page..
< html xmlns="http://www.w3.org/1999/xhtml" >
< head runat="server" >
< title >Web host< /title >
< script type="text/javascript" >
function showmessage() {
debugger;
var winctrl = document.getElementById("DicomT");
winctrl.innerHTML("Message sent from the HTML page!!");
}
< /script >
< /head >
< body >
< form id="form1" runat="server" >
< div >
< h1 >Windows form control< /h1 >
< object id="DicomT" height="300" width="500" classid="http://localhost/Testhost.dll#Testhost.UsercontrolTest" >
< /object >
< br/ >
< asp:Literal ID="Literal1" runat="server" >< /asp:Literal >
< br/ >
< input type="button" onclick="showmessage()" value="Send Message"/ >
< /div >
< /form >
< /body >
< /html >
can anyone help me , its quite urgent.
Thanks in advacnce...
答
我希望您的查询将在下面解决链接。
[使用-a-windows-application-on-the-web]
I hope your query will be solved below link.
[using-a-windows-application-on-the-web]