资源简介
两种方式实现网页快照,快速截屏网页,不必打开浏览器
代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using browerPhoto.core;
namespace browerPhoto
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender EventArgs e)
{
var url = “www.baidu.com“;
var dir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
var path = Path.Combine(dir DateTime.Now.Ticks + “.jpg“);
ImageHelper.SaveUrlToImage(url path ImageType.JPG);
MessageBox.Show(“生成成功!“);
}
private void button2_Click(object sender EventArgs e)
{
Bitmap m_Bitmap = WebSnapshotsHelper.GetWebSiteThumbnail(“www.baidu.com“ 800 1200 800 1200); //宽高根据要获取快照的网页决定
var dir = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
m_Bitmap.Save(dir+“//render_img.bmp“ System.Drawing.Imaging.ImageFormat.Bmp); //图片格式可以自由控制
MessageBox.Show(“生成成功!“);
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 187 2016-12-07 20:06 browerPhoto\browerPhoto\App.config
文件 15360 2016-12-07 20:40 browerPhoto\browerPhoto\bin\Debug\browerPhoto.exe
文件 187 2016-12-07 20:06 browerPhoto\browerPhoto\bin\Debug\browerPhoto.exe.config
文件 38400 2016-12-07 20:40 browerPhoto\browerPhoto\bin\Debug\browerPhoto.pdb
文件 24224 2016-12-07 20:40 browerPhoto\browerPhoto\bin\Debug\browerPhoto.vshost.exe
文件 187 2016-12-07 20:06 browerPhoto\browerPhoto\bin\Debug\browerPhoto.vshost.exe.config
文件 490 2013-03-18 17:00 browerPhoto\browerPhoto\bin\Debug\browerPhoto.vshost.exe.manifest
文件 3840054 2016-12-07 20:33 browerPhoto\browerPhoto\bin\Debug\render_img.bmp
文件 3903 2016-12-07 20:33 browerPhoto\browerPhoto\browerPhoto.csproj
文件 9523 2016-12-07 20:13 browerPhoto\browerPhoto\core\ImageHelper.cs
文件 2640 2016-12-07 20:31 browerPhoto\browerPhoto\core\WebSnapshotsHelper.cs
文件 1340 2016-12-07 20:44 browerPhoto\browerPhoto\Form1.cs
文件 3215 2016-12-07 20:31 browerPhoto\browerPhoto\Form1.Designer.cs
文件 5817 2016-12-07 20:31 browerPhoto\browerPhoto\Form1.resx
文件 1041 2016-12-07 20:40 browerPhoto\browerPhoto\obj\Debug\browerPhoto.csproj.FileListAbsolute.txt
文件 977 2016-12-07 20:33 browerPhoto\browerPhoto\obj\Debug\browerPhoto.csproj.GenerateResource.Cache
文件 2211 2016-12-07 20:18 browerPhoto\browerPhoto\obj\Debug\browerPhoto.csprojResolveAssemblyReference.cache
文件 15360 2016-12-07 20:40 browerPhoto\browerPhoto\obj\Debug\browerPhoto.exe
文件 180 2016-12-07 20:33 browerPhoto\browerPhoto\obj\Debug\browerPhoto.Form1.resources
文件 38400 2016-12-07 20:40 browerPhoto\browerPhoto\obj\Debug\browerPhoto.pdb
文件 180 2016-12-07 20:33 browerPhoto\browerPhoto\obj\Debug\browerPhoto.Properties.Resources.resources
文件 865 2016-12-07 20:07 browerPhoto\browerPhoto\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 7112 2016-12-07 20:30 browerPhoto\browerPhoto\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 0 2016-12-07 20:07 browerPhoto\browerPhoto\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
文件 0 2016-12-07 20:07 browerPhoto\browerPhoto\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
文件 0 2016-12-07 20:07 browerPhoto\browerPhoto\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
文件 534 2016-12-07 20:07 browerPhoto\browerPhoto\Program.cs
文件 1452 2016-12-07 20:07 browerPhoto\browerPhoto\Properties\AssemblyInfo.cs
文件 2852 2016-12-07 20:07 browerPhoto\browerPhoto\Properties\Resources.Designer.cs
文件 5612 2016-12-07 20:06 browerPhoto\browerPhoto\Properties\Resources.resx
............此处省略16个文件信息
- 上一篇:C#图形界面汉诺塔Hanoi
- 下一篇:照片管理系统,用于管理照片,c#
评论
共有 条评论