易截截图软件、单文件、免安装、纯绿色、仅160KB

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


相关文档:

如何模拟点击HTML中的链接

http://blog.stchur.com/2010/01/15/programmatically-clicking-a-link-in-javascript/
作者介绍如何用javascript模拟用户真实的点击。
这看上去好像很简单,读取href然后利用window.location.href不就行了吗?
其实不然,原因在于现在的网页里的链接不单是直接读取href属性然后跳转到另一个页面,有些链接可以加上event ......

解析C#中is和as操作符的用法

c# 中 is和as 操作符是用来进行强制类型转换的
is : 检查一个对象是否兼容于其他指定的类型,并返回一个Bool值,永远不会抛出异常
object o = new object();
if (o is Label)
{
Label lb = (Label)o;
Response.Write("类型转换成功");
}
else
{
Response.Write(" ......

html總結(中)

有關html窗體框架的問題,如果想要實現在一個畫面中分割窗體,並且通過點擊其中的一個窗體,鏈接內容至同一個畫面中的另一個窗體。就需要使用<frameset>與<frame>的 ......

[HTML] document domain 的说明

先来看段代码:
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 ......

用C#读SQL SERVER到控制台的简单示例

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
namespace ConsoleApplication4
{
class Program
{
static void Main(string[] args)
{
//sqlserver身份验证
//string sqlconn = "ser ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号