易截截图软件、单文件、免安装、纯绿色、仅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


相关文档:

常见算法C#描述

冒泡排序
using System;
class Program
{
public static void Main()
{
int[] a = new int[10];
Random rand = new Random();
for (int i = 0; i < 10; i++)
{
a[i] = rand.Next(10);//生成随机数给数组赋值
}
for (int i = 0; i < ......

C#导出xls,word,图片及样式问题

public void ExportControl(System.Web.UI.Control source, string DocumentType, string filename)
{
//设置Http的头信息,编码格式
HttpContext.Current.Response.Buffer = true;
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.ClearContent();
......

C#获取当前路径的方法

//获取包含清单的已加载文件的路径或 UNC 位置。
public static string sApplicationPath = Assembly.GetExecutingAssembly ( ).Location;
//result: X:\xxx\xxx\xxx.dll (.dll文件所在的目录+.dll文件名)
//获取当前进程的完整路径,包含文件名(进程名)。
string str = this.GetType ( ).Assembly.Location;
//result ......

解析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>的 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号