假设第一页打印出一个黑色矩形
第二页打印出一个红色举行我只能打印出第一页,第二页不止到如何处理以下为我的代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace 打印测试
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
//第一页的矩形
e.Graphics.DrawRectangle(new Pen(Brushes.Black), new Rectangle(0, 0, 200, 200));
//第二页的矩形
e.Graphics.DrawRectangle(new Pen(Brushes.Bisque), new Rectangle(0, 0, 400, 400));
} private void button1_Click(object sender, EventArgs e)
{
this.printPreviewDialog1.ShowDialog();
}
}
}
第二页打印出一个红色举行我只能打印出第一页,第二页不止到如何处理以下为我的代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace 打印测试
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
//第一页的矩形
e.Graphics.DrawRectangle(new Pen(Brushes.Black), new Rectangle(0, 0, 200, 200));
//第二页的矩形
e.Graphics.DrawRectangle(new Pen(Brushes.Bisque), new Rectangle(0, 0, 400, 400));
} private void button1_Click(object sender, EventArgs e)
{
this.printPreviewDialog1.ShowDialog();
}
}
}
解决方案 »
- 智能手机网站怎么上传图片?请教
- Winform GDI+绘图的问题
- 帮忙稍稍改个正则.以适应新改版的内容。谢谢大家
- asp.net 缓存 问题,输出 gzip压缩文件
- winform datagrid scrollbar 颜色修改
- WebBrowser的使用问题
- 在winForm里,treeView中设置为checkbox,但是有些节点的checkbox希望设置为灰色,或者checkbox不可见也行
- 关于页面传值出现的奇怪问题,急等解决!!!!!!!!!!!
- RPC服务器不可用??是什么意思?
- 如何将dataview中的更改提交到dataset中?
- 用System.Data.OracleClient组件插blob时当blob的值大于8k的时候就会报错 "ora-01460 转换请求无法实现或者不合理"
- 用ADO.net操作数据库(插入,更改等)代码好象没有问题,但我在打开SQL SERVER2000企业管理器时怎么数据表不随着更新,还有一个问题就是数据
要是这样我还不如自动建立printDocuments
{
//第一页的矩形
e.Graphics.DrawRectangle(new Pen(Brushes.Black), new Rectangle(0, 0, 200, 200));
e.HasMorePage=true;//分页
//第二页的矩形
e.Graphics.DrawRectangle(new Pen(Brushes.Bisque), new Rectangle(0, 0, 400, 400));
}
www.WebMIS.com.cn有分页原理与实现的文档与源码www.AnyReport.Net套打
尝试一下吧。namespace 打印测试
{
public partial class Form1 : Form
{
int pageCount=0;
public Form1()
{
InitializeComponent();
} private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
if(pageCount==0)
{
//第一页的矩形
e.Graphics.DrawRectangle(new Pen(Brushes.Black), new Rectangle(0, 0, 200, 200));
pageCount++;
e.HasMorePages = true;
return;
}
if(pageCount==1)
{
//第二页的矩形
e.Graphics.DrawRectangle(new Pen(Brushes.Bisque), new Rectangle(0, 0, 400, 400));
pageCount=0;
e.HasMorePages = false;
return;
}
} private void button1_Click(object sender, EventArgs e)
{
this.printPreviewDialog1.ShowDialog();
}
}
}呵呵,刚解决的!