62,072
社区成员
发帖
与我相关
我的任务
分享
protected void Page_Load(object sender, EventArgs e)
{
this.CreateImage();//这个是画图功能
this.Cutpicture();//这个是截图功能
}
private void Cutpicture()
{
Rectangle R = System.Windows.Forms.Screen.PrimaryScreen.Bounds;
R.Width = 540;
R.Height = 400;
System.Drawing.Image img = new Bitmap(R.Width, R.Height);
Graphics G = Graphics.FromImage(img);
G.CopyFromScreen(new Point(0,86), new Point(0, 0), new Size(R.Width, R.Height));
IntPtr dc = G.GetHdc();
G.ReleaseHdc(dc);
G.Dispose();
img.Save("c:\\a.jpg");
}
function run()
{
alert('延时4秒')
}
$(document).ready(function () {
$.ajax
({
type: "GET",
url: "CutPicture.aspx/CutPictureImg",
beforeSend: function () {
alert('正在加载');
setTimeout(function(){run()},4000);
},
success: function (data) {
alert('加载完成');
}
});
});
试试
<script>
function run() {
alert('延时1秒') }
window.onload = function () {
setTimeout('run()', 1000)
}
$(document).ready(function () {
$.ajax
({
type: "GET",
url: "CutPicture.aspx/CutPictureImg",
beforeSend: function () {
alert('正在加载');
},
success: function (data) {
alert('加载完成');
}
});
});
</script>
有两个页面一个是画图页面graphic.aspx,上面的代码放在里头。
另一个页面是CutPicture.aspx,里头有CutPictureImg方法,不知道我这样放对不对。谢谢!$(document).ready(function () {
$.ajax
({
type: "GET",
url: "xxx.aspx/Cutpicture",
beforeSend: function () {
alert('正在加载');
},
success: function (data) {
alert('加载完成');
}
});
});