|
楼主 |
发表于 2017-10-11 20:16:01
|
显示全部楼层
1.请求远程头像的代码:
chatListSubItemNum.HeadImage = WeichatTool.CreateHttpimg("https://wx.qq.com" + rows.HeadImgUrl);
2.请求头像的方法:
//7.获取好友的头像.
public static Image CreateHttpimg(string url)
{
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = url,
Cookie = HttpCookie,
ResultType = ResultType.Byte
};
HttpResult result = http.GetHtml(item);
string statusCodeDescription = result.StatusDescription;
return byteArrayToImage(result.ResultByte);
}
3.头像处理
private static Image byteArrayToImage(byte[] Bytes)
{
using (MemoryStream ms = new MemoryStream(Bytes)) {
Image outputImg = Image.FromStream(ms);
return outputImg;
}
} |
|