我的问题很简单。我需要在多用户ERP环境中显示打印预览对话框。打印应该尽可能快,这一点不言而喻。然而,如果我使用下面的代码,它需要大约10分钟!预览显示并完全生成前的秒数。这不需要数据库访问或任何其他CPU密集型操作。
有没有办法或方法来提高这个性能呢?如果有必要的话,我也可以使用WPF。
我注意到,如果你生成预览,关闭它,然后快速地再次生成它,它的响应速度要快得多,大约一两秒。如果您再等待5秒左右,再次生成它,则需要大约10秒。我猜某种类型的缓存正在进行,但不知道实际发生了什么。
using System;
using System.Collections.Generic;
using Sy
我正在编写一个使用Visual Studio 2008/C#打印格式化数据的应用程序。我已经按照我想要显示的方式格式化了数据。我使用两个打印文档和事件处理程序,因为报告的第一页具有与第2页到第N页不同的格式要求。
打印预览为我尝试打印的所有页面显示正确格式化的数据。但是,第2页到第N页实际上不会打印。
我已经单步执行了我的代码,数据被正确地传递给了事件处理程序。这是调用第二个打印文档的事件处理程序的代码块。我做错了什么?
// First page print limit has been reached. Do we
// still have unpri
我需要些帮助。我的要求是,当用户点击打印按钮时,它应该显示一个打印预览对话框。如果用户取消或关闭预览对话框,表单必须返回到原始状态。
我面临的问题是打印预览对话框是可见的。但是我不知道如何捕捉打印预览工具的点击事件。
public void print()
{
PrintDialog pd = new PrintDialog();
PrintDocument pdoc = new PrintDocument();
PrinterSettings ps = new PrinterSettings();
PaperSize p
这是我第一次使用打印预览,我感到困惑,所以我需要一个建议:
这是我想要打印的对话框:
这是它在我的PrintPreview对话框中的当前外观(乱七八糟):
这是我目前的完整代码:
Public Class frmPRINT
Private Sub btnPrint_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
PrintDocument1.Print()
End Sub
Private Sub PrintDocument1_PrintP
我正在开发一个应用程序来print preview的文件,用户喜欢打印,我写了以下代码,但我无法看到的文本或预览页面上的内容为什么它会发生,任何人可以帮助我
我的代码如下
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Printing;
using System.IO;
大家好,当我的网站在显示打印预览对话框时,我收到了这个错误
PrintPreviewDialog ppdlg = new PrintPreviewDialog();
ppdlg.ShowDialog();
如何解决此错误
完全错误
Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to
我正在尝试从Windows2005Windows应用程序中预览和打印多页C#文件。打印工作正常,但是当我向PrintPreviewDialog发送我的PrintDocument时,我得到的是第一页的两幅图像,而不是第一页和第二页的平均图像。我在使用PrintPreviewControl时也遇到了同样的问题。
下面是一个包含两个按钮、一个PrintDocument和一个PrintPreviewDialog的窗体代码,用于演示该问题。
public partial class Form1 : Form
{
private Image m_Image;
private Int32 m
我想在PrintPreviewDialog中查看100个项目。为此,我使用Stringbuilder构建字符串,然后设置它们的字体大小并启动PrintPreviewDialog。此时,程序运行良好,但并不是所有的100个项目都显示在PrintPreviewDialog中,它只显示32个项目和1个页面。请告诉我如何在一页或多页中显示所有项目。
for (int i = 0; i < 100; i++)
{
Item item = new Item()
{
Code = i.ToString(),
WPF有没有像Google Chrome或Word那样与WPF中的打印预览对话框相结合的打印对话框?
此时,我使用Windows窗体中的打印预览对话框。我也尝试使用它的WPF版本。但是WPF没有PrintPreviewDialog或PrintPrewiewControl。这是我的代码:
//To the top of my class file:
using Forms = System.Windows.Forms;
//in a methode on the same class:
PageSettings setting = new PageSettings();
settin
作为VB的新程序员,我努力让我的打印例程正常工作。通过搜索大量资源,我开发了下面的混合程序,它可以打印一个简单的.txt文件。我的问题听起来很简单,但我学到了打印没有什么是简单的。如何在打印完成后关闭PrintPreviewDialog? Private Sub BtnPrint_Click(sender As Object, e As EventArgs) Handles BtnPrint.Click
Try
PrintPreviewDialog1.Document = PrintDocument1
PageSetupDialog1.Pag
我正在使用printDocument从列表视图中打印。这一切都运行得很好。最初,当print对话框打开时,我可以使用默认打印机或选择其他打印机(如adobe、pdf或send to one-note)。现在对话框仍然显示,但无论我选择什么选项,总是打印到默认打印机。我没有故意做任何更改,但可能无意中更改了一个属性或其他东西。有谁知道我可能做了什么吗?
我正在尝试打印一个有7列和100行的数据集。我用了位图。但它只打印55行,即只有1页打印页面,不生成多个打印页面。对不起我的英语不好。请帮帮忙。
提前结束..。
这是我的代码:
Private bitmap As Bitmap
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
'************************RESIZE DATAGRID VIEW TO FULL SIZE **********
我试图打印一个面板,问题是它只是显示“打印”,但实际上不打印
Private bmp As Bitmap
Private Sub PrintDocument2_PrintPage(sender As Object, e As PrintPageEventArgs) Handles PrintDocument2.PrintPage
e.Graphics.DrawImage(bmp, 0, 0)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Butt
我试图得到一个按钮,打印出我的当前表单,并尝试了所有的代码,我可以在这里找到,但它一直打印空白页,我无法计算出原因。
我使用的代码如下
Bitmap bitmap;
private void btnPrint_Click(object sender, EventArgs e)
{
//Add a Panel control.
Panel panel = new Panel();
this.Controls.Add(panel);
//Create a Bitmap of size same as that of the Form.
Graphics grp = panel.CreateGra
我有一个从数据库中检索信息的Datagrid,我希望打印输出是带有行和列的表格格式。我的实际方法很简单,但是输出非常混乱。有什么想法吗?
Private Sub Imprimir_Click(sender As Object, e As EventArgs) Handles Imprimir.Click
PrintPreviewDialog1.PrintPreviewControl.Zoom = 1.0
PrintPreviewDialog1.FindForm.WindowState = FormWindowState.Maximized
PrintPreviewD
我写了一个使用MICR字体打印支票的代码,每件事都很好,但当我来打印预览时,我得到了正常的文本,但当打印文件时,我得到了所需的MICR字体。如何在打印预览中显示MICR字体
这是我的代码
PrivateFontCollection PFC = new PrivateFontCollection();
PFC.AddFontFile(Server.MapPath("ADVMICR.TTF"));
FontFamily fm = new FontFamily(PFC.Families[0].Name, PFC);
Font PrintFont = new F