关于打印的bug!!!!!!!!!!!!!!!!

哥本哈根 2013-02-05 11:58:20
开发环境:
Windows7 x64 旗舰版
vs2008 32位

bug如下:
新建一个窗体,里面一个按钮 《弹框》,一个printDocument1控件

《弹框的代码》:


PrintDialog printDialog1 = new PrintDialog();
printDialog1.Document = this.printDocument1;

if (printDialog1.ShowDialog() == DialogResult.OK)
{
printDocument1.DefaultPageSettings.Landscape = true;
this.printDocument1.Print();

}



弹不出来打印提示框!!!!!!!!!!!!!!!!!!!!!



第二:如果从工具箱中拉一个printDialog1控件到窗体上
《弹框》代码如下:

//PrintDialog printDialog1 = new PrintDialog();
//printDialog1.Document = this.printDocument1;

if (printDialog1.ShowDialog() == DialogResult.OK)
{
printDocument1.DefaultPageSettings.Landscape = true;
this.printDocument1.Print();

}

则可以弹出打印提示框!!!!!!!!!!!!!!!!!


求解:为什么自己实例化的打印对话框不能弹出,而拉过来的控件则可以呢?




这两段代码在vs2010上都能弹出打印提示框,但是提示框的样子都不一样!!!!!!!!
求解!
...全文
175 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
哥本哈根 2013-02-05
  • 打赏
  • 举报
回复
引用 1 楼 devmiao 的回复:
将PrintDialog printDialog1 = new PrintDialog(); printDialog1.Document = this.printDocument1;写在成员变量而不是函数内。
引用 2 楼 hjywyj 的回复:
将PrintDialog printDialog1 = new PrintDialog();放函数外面
都不行 这个问题仅仅应该是发生在 win7 64位 vs2008 32位上吧 我安装一下 vs2008 64位的测试一下
EnForGrass 2013-02-05
  • 打赏
  • 举报
回复
you can contact http://msdn.microsoft.com/en-us/vstudio/cc136615.aspx for help.
哥本哈根 2013-02-05
  • 打赏
  • 举报
回复
由 Microsoft 在 2010/9/6 19:36 发送 Hi Piotr Mioduszewski, Thanks again for your feedback. But now we are no longer accepting bugs for Microsoft Visual Studio 2008 and earlier products. we only support the latest Visual Studio versions for bug/suggestion. We are therefore closing this issue. For Visual Studio 2008 and earlier products, you can contact http://msdn.microsoft.com/en-us/vstudio/cc136615.aspx for help. Sorry for the inconvenience. 微软的bug修复竟然不支持了
EnForGrass 2013-02-05
  • 打赏
  • 举报
回复
引用 楼主 hello_wys 的回复:
开发环境: Windows7 x64 旗舰版 vs2008 32位 bug如下: 新建一个窗体,里面一个按钮 《弹框》,一个printDocument1控件 《弹框的代码》: C# code?123456789PrintDialog printDialog1 = new PrintDialog(); printDialog1.Do……
哦,win7就不知道了。 看到一个类似的帖子http://connect.microsoft.com/VisualStudio/feedback/details/595335/problem-with-displaying-printdialog-on-windows-7-64-bit
EnForGrass 2013-02-05
  • 打赏
  • 举报
回复
引用 楼主 hello_wys 的回复:
开发环境:
Windows7 x64 旗舰版
vs2008 32位

bug如下:
新建一个窗体,里面一个按钮 《弹框》,一个printDocument1控件

《弹框的代码》:
C# code?123456789PrintDialog printDialog1 = new PrintDialog(); printDialog1.Do……

可以弹出打印框的啊,

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
PrintDialog printDialog1 = new PrintDialog();
printDialog1.Document = this.printDocument1;

if (printDialog1.ShowDialog() == DialogResult.OK)
{
printDocument1.DefaultPageSettings.Landscape = true;
this.printDocument1.Print();

}
}
}
}

冲天 2013-02-05
  • 打赏
  • 举报
回复
界面都不一样




  • 打赏
  • 举报
回复
将PrintDialog printDialog1 = new PrintDialog();放函数外面
devmiao 2013-02-05
  • 打赏
  • 举报
回复
将PrintDialog printDialog1 = new PrintDialog(); printDialog1.Document = this.printDocument1;写在成员变量而不是函数内。
  • 打赏
  • 举报
回复
难不成是vs版本的问题?一个一个试下哈。

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧