0

webwiev のウェブサイトから CAPTCHA 画像をコピーして imagewiev に貼り付ける方法はありますか? 以前は VB.NET で作業していたので、新しいことに挑戦しています。これはコード形式 vb です:

Private Sub captcha()
     Dim doc As mshtml.IHTMLDocument2 = WebBrowser1.Document.DomDocument

     Dim imgrange As mshtml.IHTMLControlRange = CType(doc.body, mshtml.HTMLBody).createControlRange
        For Each img As mshtml.IHTMLImgElement In doc.images
            If img.getattribute("src").ToString.Contains("jkjkhjkhjk") Then
                imgrange.add(img)
                imgrange.execCommand("copy", False, Nothing)
                PictureBox1.Image = Clipboard.GetDataObject.GetData(DataFormats.Bitmap)
                Exit For
            End If
        Next
End Sub
4

1 に答える 1

0

imageView に貼り付ける方法はなく、Web ビューをロードするだけです。そのように、

 [self.captchaWebView loadHTMLString:@"<html><head><style type='text/css'>a {color:white;font-size:20px;font-style:bold}small{color:white;font-size:20px;font-style:bold}</style><script type='text/javascript'>var a = 49; b= 65; var c =100; var d = 70;var f=85;function DrawCaptcha(){if(a==57){a=49;}var main = document.getElementById('captchaText'); var a1=String.fromCharCode(a);var b1=String.fromCharCode(b);var c1=String.fromCharCode(c);var d1=String.fromCharCode(d);var f1=String.fromCharCode(f);main.innerHTML = a1+b1+c1+d1+f1;a=a+1;b=b+1;c=c+1;d=d+1;f=f+1;}function ValidCaptcha(){var str1=document.getElementById('captchaText').innerHTML;var str2=document.getElementById('txtinput').value;if(str1==str2)return true;return false;}</script></head><body bgcolor = 'rgb(231,184,17)'><lable style='font-size:28px;'><font color='white' face = 'helevetica Bold'><b>&nbsp;&nbsp;&nbsp;Enter Captcha</b></font></label><br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span id='captchaText' style='font-size:25pt;font-family:Chalkduster'>5Klne</span><br/><br/><input type='text' style=border:none;font-size:20px;height:40px' id='txtinput' /><br/><br/>&nbsp;&nbsp;<small>Can't read this? </small><a href='#' onclick='DrawCaptcha()'>try another</a></body></html>" baseURL:nil];
于 2013-09-06T04:27:35.113 に答える