C#.net中用WinForm接收html页面消息的程序
首先写一个页面,上面要放一个Button
<html>
<head>
<title></title>
</head>
<body>
<input id="Button1" type="button" value="button" />
</body>
</html>
将其保存在HomePage.htm中,
之后我们建一个WinForm,
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace SXT.Frame.Ctrler.Test
{
public partial class HtmlUi : Form
{
public HtmlUi()
{
InitializeComponent();
this.webBrowser1.Navigate("D:\\SXT\\bin\\Debug\\HomePage.htm");//本地文件路径
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
HtmlDocument htmlDoc = this.webBrowser1.Document;
HtmlElement btnElement = htmlDoc.All["Button1"];
if (btnElement != null)
{
btnElement.Click += new HtmlElementEventHandler(btnElement_Click);
}
}
void btnElement_Click(object sender, HtmlElementEventArgs e)
&n
相关文档:
//获取包含清单的已加载文件的路径或 UNC 位置。
public static string sApplicationPath = Assembly.GetExecutingAssembly ( ).Location;
//result: X:\xxx\xxx\xxx.dll (.dll文件所在的目录+.dll文件名)
//获取当前进程的完整路径,包含文件名(进程名)。
string str = this.GetType ( ).Assembly.Location;
//result ......
摘抄前辈们的
其实要实现这个功能主要还是要用到javascript
方法一:
在asp.net的aspx里面的源代码中
<input type="button onclick="javascript:window.history.go(-1);"value="返回上一页">
浅析:这个是用了HTML控件,通过一个onclick的事件,调用了javascript中的一个方法就可以了。这个是最简单的了,也同样 ......
有關html窗體框架的問題,如果想要實現在一個畫面中分割窗體,並且通過點擊其中的一個窗體,鏈接內容至同一個畫面中的另一個窗體。就需要使用<frameset>與<frame>的 ......
上篇文章中说到什么是 Cache对象,如何在ASP.NET中使用 Cache对象。下面我们来说说如何在ASP.NET中删除项。
ASP.NET Cache 对象设计用于保证它并不使用过多的服务器内存。结果是,当用内存变得缺乏时,Cache对象自动删除最少被使用的项。你可以通过定义时间限制、依赖项、以及项
在Cache对象中的优先级来影响 Cache对象保 ......
先来看段代码:
document.domain = 'ray.com';
这段代码到底是什么意思呢?
首先,我们来看下HTML DOM 关于这个的说明:
domain of type DOMString, readonlyThe domain name of the server that served the document, or null if the server cannot be identified by a domain name.
这段话的意思是这个值是DO ......