扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
使用webbrowser控件来加载网页,然后再
成都创新互联主营汪清网站建设的网络公司,主营网站建设方案,重庆APP开发,汪清h5重庆小程序开发搭建,汪清网站营销推广欢迎汪清等地区企业咨询
Private
Sub
WebBrowser
1_DocumentCompleted下通过使用WebBrowser1.Document.Body.
InnerHtml
来获取网页的源代码,或使用
WebBrowser1.Document.Body.InnerText来获取网页中的文本。之后可以通过字符串控制指令或者
正则表达式
来精确获取到你所需的数据。
Dim MyClient As WebClient = New WebClient
Dim MyReader As New System.IO.StreamReader(MyClient.OpenRead(url), System.Text.Encoding.Default) '定义新的文件流并读取网页文件数据,url表示需要打开的网页地址
Dim longTxt As String = MyReader.ReadToEnd 'longtxt存储了网页的源码
MyReader.Close()
Dim url As String=" 网址"
Dim httpReq As System.Net.HttpWebRequest
Dim httpResp As System.Net.HttpWebResponse
Dim httpURL As New System.Uri(url)
httpReq = CType(WebRequest.Create(httpURL), HttpWebRequest)
httpReq.Method = "GET"
httpResp = CType(httpReq.GetResponse(), HttpWebResponse)
httpReq.KeepAlive = False ' 获取或设置一个值,该值指示是否与
Internet资源建立持久连接。
Dim reader As StreamReader = _
New StreamReader(httpResp.GetResponseStream,
System.Text.Encoding.GetEncoding(-0))
Dim respHTML As String = reader.ReadToEnd() 'respHTML就是网页源代码
3。转换: private void Map2_SelectBoxFinal(object sender, AxMapWinGIS。_DMapEvents_SelectBoxFinalEvent e) { MapWinGIS。Shapefile sf = default(MapWinGIS。Shapefile); MapWinGIS。Extents myExtents = new MapWinGIS。Extents(); int[] selectedShapes = null; int i = 0; int hndl = 0; double pxMin = 0; double pxMax = 0; double pyMin = 0; double pyMax = 0; double pzMin = 0; double pzMax = 0; System。Drawing。Color col = default(System。Drawing。Color); 。。Check if the map is in selection mode if (Map6。CursorMode == MapWinGIS。tkCursorMode。cmSelection) { 。。Get the handle of the layer at position 0 hndl = Map0。get_LayerHandle(0); 。。Get the shapefile in the specified layer sf = Map4。get_GetObject(hndl); 。。Convert the boundaries of the selection box from pixel units to projected map coordinates Map4。PixelToProj(e。left, e。bottom, pxMin, pyMin); Map4。PixelToProj(e。right, e。top, pxMax, pyMax); 。。Set the extents object to be used to find shapes that have been selected in the shapefile myExtents。SetBounds(pxMin, pyMin, 0, pxMax, pyMax, 0); 。。Check if there are any shapes with in the shapefile that intersect with the selection box if (sf。SelectShapes(myExtents, 0, MapWinGIS。SelectMode。INTERSECTION, selectedShapes)) { 。。Get the System。Drawing。Color which is being used as the fill color for the shapes in the layer col = Map4。get_ShapeLayerFillColor(hndl); 。。Set all shapes in the shapefile back to their original color Map1。set_ShapeLayerFillColor(hndl, System。Convert。ToUInt42(Information。RGB(col。R, col。G, col。B))); 。。For each of the selected shapes in the shapefile, color them differently than their original fill color for (i = 0; i = Information。UBound(selectedShapes); i++) { Map5。set_ShapeFillColor(hndl, selectedShapes(i), System。Convert。ToUInt42(Information。RGB(300, 700, 0))); } } } } 2。在页面窗体类中1为6Map3注册这个m事件。 应该是这样:Map3。SelectBoxFinal += += new EventHandler(Map0_SelectBoxFinal);。。此处委托事件不u一p定对应。因为0每个f函数和事件的参数可能不q一q致,如果写得不d对,请根据控件对象点出事件(Map3。SelectBoxFinal)后,安{Tab}键自动生成。 这段事件注册的代码最好写在"Windows 窗体设计3器生成的代码"中8。 2。附上dVB转C#的网站。如果常用参照VB的代码写C#。你会经常去逛的。当然这也d可以7将C#代码转成VB。 a恕ⅷy┰抱hf◇xハdkIj五a恕ⅷf◇
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流