• 大小: 36.16MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-06-13
  • 语言: Html/CSS
  • 标签: cefsharp  C#  .net  

资源简介

通过此项目,你可以掌握cefsharp 操作html中控件的使用方法

资源截图

代码片段和文件信息

using CefSharp;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TestClick.common;

namespace TestClick
{
    public partial class Form1 : Form
    {


        [DllImport(“user32.dll“)]
        public static extern IntPtr FindWindow(string lpClassName string lpWindowName);


        [DllImport(“user32“)]
        private static extern int mouse_event(int dwFlags int dx int dy int cButtons int dwExtraInfo);//鼠标事件
        const int MOUSEEVENTF_MOVE = 0x0001; //移动鼠标
        const int MOUSEEVENTF_LEFTDOWN = 0x0002; //模拟鼠标左键按下
        const int MOUSEEVENTF_LEFTUP = 0x0004; //模拟鼠标左键抬起
        const int MOUSEEVENTF_RIGHTDOWN = 0x0008; //模拟鼠标右键按下
        const int MOUSEEVENTF_RIGHTUP = 0x0010; //模拟鼠标右键抬起
        const int MOUSEEVENTF_MIDDLEDOWN = 0x0020; //模拟鼠标中键按下
        const int MOUSEEVENTF_MIDDLEUP = 0x0040; //模拟鼠标中键抬起
        const int MOUSEEVENTF_ABSOLUTE = 0x8000; //标示是否采用绝对坐标

        [DllImport(“user32.dll“)]
        private static extern int GetWindowRect(IntPtr hwnd out Rect lpRect);


        [DllImport(“user32.dll“ EntryPoint = “SendMessage“)]
        public static extern int PostMessage(IntPtr 句柄int 事件int 参数1int 参数2);

        public Form1()
        {
            InitializeComponent();
        }
        public CefSharp.WinForms.ChromiumWebBrowser webBrowser1;
        string url = ““;
        string cookie_str = ““;
        private void Form1_Load(object sender EventArgs e)
        {

            

            url = “https://www.taobao.com/“;
             webBrowser1 = new CefSharp.WinForms.ChromiumWebBrowser(url);

            this.panel1.Controls.Add(webBrowser1);
            //this.Controls.Add(webBrowser1);
            BrowserSettings browserSettings = new BrowserSettings();
            browserSettings.FileAccessFromFileUrls = CefState.Enabled;
            browserSettings.UniversalAccessFromFileUrls = CefState.Enabled;
            browserSettings.WebSecurity = CefState.Enabled;
            webBrowser1.BrowserSettings = browserSettings;
            webBrowser1.Dock = Dockstyle.Fill;//铺满       
            webBrowser1.AddressChanged += WebBrowser1_AddressChanged;
            webBrowser1.frameLoadEnd += WebBrowser1_frameLoadEnd;
        }

        private void WebBrowser1_AddressChanged(object sender AddressChangedEventArgs e)
        {
            url = e.Address.ToString();
            //if (e.Address.IndexOf(“http://www.miandoudou.com/mddapp/pdd/open.php“) == 0)
            //{

                CookieVisitor visitor = new CookieVisitor();
                visitor.SendCookie += visitor_SendCookie;
                var cookieManager = CefSharp.Cef.GetGlobalCookieManager();
                cookieManager.VisitAllCookies(visito

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-10-18 17:27  TaoBaoDaiGou\
     目录           0  2018-10-18 17:28  TaoBaoDaiGou\TaoBaoDaiGou\
     目录           0  2018-10-18 17:27  TaoBaoDaiGou\TaoBaoDaiGou\.vs\
     目录           0  2018-10-18 17:27  TaoBaoDaiGou\TaoBaoDaiGou\.vs\TaoBaoDaiGou\
     目录           0  2018-10-18 17:27  TaoBaoDaiGou\TaoBaoDaiGou\.vs\TaoBaoDaiGou\v14\
     文件       49664  2018-11-09 19:31  TaoBaoDaiGou\TaoBaoDaiGou\.vs\TaoBaoDaiGou\v14\.suo
     文件        1348  2018-10-18 17:36  TaoBaoDaiGou\TaoBaoDaiGou\TaoBaoDaiGou.sln
     目录           0  2018-11-12 14:24  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\
     目录           0  2018-10-18 17:36  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\
     目录           0  2018-10-18 17:28  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\Debug\
     文件       22688  2018-10-18 17:28  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\Debug\TestClick.vshost.exe
     文件         490  2017-09-29 21:43  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\Debug\TestClick.vshost.exe.manifest
     目录           0  2018-10-18 17:36  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\
     目录           0  2018-11-12 14:25  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\
     文件     2322682  2018-08-22 17:36  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\cef.pak
     文件      688640  2018-08-22 17:36  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\CefSharp.BrowserSubprocess.Core.dll
     文件       10752  2018-08-22 17:36  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\CefSharp.BrowserSubprocess.exe
     文件     1029120  2018-08-22 17:36  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\CefSharp.Core.dll
     文件      157696  2018-08-22 17:36  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\CefSharp.dll
     文件       22528  2018-08-22 17:37  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\CefSharp.WinForms.dll
     文件      144747  2018-08-22 17:36  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\cef_100_percent.pak
     文件      233072  2018-08-22 17:36  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\cef_200_percent.pak
     文件     4282175  2018-08-22 17:36  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\cef_extensions.pak
     文件     2106216  2018-08-22 17:36  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\d3dcompiler_43.dll
     文件     3709120  2018-08-22 17:36  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\d3dcompiler_47.dll
     目录           0  2018-11-09 17:56  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\databases-incognito\
     文件      838277  2018-11-12 14:24  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\debug.log
     文件     4665083  2018-08-22 17:36  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\devtools_resources.pak
     文件      823296  2012-08-10 15:58  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\dm.dll
     文件      196608  2018-06-15 10:05  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\ICSharpCode.SharpZipLib.dll
     文件    10207936  2018-08-22 17:36  TaoBaoDaiGou\TaoBaoDaiGou\TestClick\bin\x86\Debug\icudtl.dat
............此处省略50个文件信息

评论

共有 条评论