首页 新闻 会员 周边

winform程序卡死问题

0
悬赏园豆:100 [已解决问题] 解决于 2011-07-21 12:07

有两个winform窗体,Form1中只有一个按钮,Form2为打印窗体,如下图

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Demo
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
////打印内容 为 局部的 this.groupBox1
Bitmap _NewBitmap = new Bitmap(190, 153);
groupBox1.DrawToBitmap(_NewBitmap,
new Rectangle(0, 0, 190, 153));
e.Graphics.DrawImage(_NewBitmap,
0, 0, 190, 153);

}
private void Form2_Load(object sender, EventArgs e)
{
try
{
if (this.printDialog1.ShowDialog() == DialogResult.OK)
{
printDocument1.DefaultPageSettings.Landscape
= false;

this.printDocument1.Print();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
this.Close();
}
}
}
}

现在的问题是程序走到加粗的代码那块时,好像就不再继续往下走了,然后整个项目都会卡死,请问谁能帮我解决一下?不清楚的可以加我Q: 4 7 2 1  7 4 8 7 7

差生的主页 差生 | 初学一级 | 园豆:3
提问于:2011-07-21 11:17
< >
分享
最佳答案
0

已解决

156074228

收获园豆:100
彭汉生 | 小虾三级 |园豆:1233 | 2011-07-21 12:04
谢谢你
差生 | 园豆:3 (初学一级) | 2011-07-21 12:05
其他回答(1)
0

图片已经挂掉了,麻烦重新上传

麦田里的守望者 | 园豆:428 (菜鸟二级) | 2011-07-21 11:23
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册