小编sci*_*15t的帖子

如何将webbrowser中加载的图像复制到picturebox

有没有办法将加载的图像从Web浏览器捕获或复制到图片框?

我要复制的图像是"验证码"图像,它将改变每个请求.我需要在Web浏览器中加载的图像与图片框相同.

我试图拆分img标签并再次请求图像.它工作但图片框图像与网络浏览器显示的图像不同.

这是我到目前为止所做的.它包含一个Web浏览器,一个图片框,一个文本框和一个按钮

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.IO;
using System.Net;

namespace arman_dobare_kir_mishavad
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string str2 = webBrowser1.DocumentText;
            string[] strArray2;
            strArray2 = Regex.Split(Regex.Split(str2, "<img id=\"content1_imgCaptcha\" src=\"")[1], "\"");
            textBox1.Text = strArray2[0];
            this.pictureBox1.ImageLocation = "http://www.hashkiller.co.uk" + strArray2[0];
            return;
        }

        public void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs …
Run Code Online (Sandbox Code Playgroud)

c# browser picturebox

0
推荐指数
1
解决办法
6895
查看次数

标签 统计

browser ×1

c# ×1

picturebox ×1