“这个事件里面写你自己的代码“ 具体指什么 能举个例子么

来源:学生作业帮助网 编辑:作业帮 时间:2024/12/01 03:13:13
“这个事件里面写你自己的代码“ 具体指什么 能举个例子么
xWmOG+[>=I[*D+i|^מכּ3EӦ"BEZNCj/aޮ!4 ;3DѐCa5e*$SM~ :X$'>+|*#>~d5 DB0)+a93vߕ[]HS.RBn]n L8'$ڞ\iObI+5'ڙu[|?br;RF=IqlA΢%$ESLj@FIQjoG5^jJ`f$B0[)zʞ4w+붾k?q8k^\N^ONH $]y?E6U nzl۞ѧʔ稃]l ϰht̛#6gx#ӓ7kk*1äXq?]v4CoUK+%:&Xt;%ls b[Ѐ-Y7P&em9e>lwt!2|Ie6GBް2;?ы&"c=΂;( U/8

“这个事件里面写你自己的代码“ 具体指什么 能举个例子么
“这个事件里面写你自己的代码“ 具体指什么 能举个例子么

“这个事件里面写你自己的代码“ 具体指什么 能举个例子么
具体就是打印的代码 都有自己写 给你我写的吧 我是写的打印界面里的控件
包括打印表就是DATAGRIDVIEW 这都得自己写
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
StringFormat sf = new StringFormat();
e.Graphics.DrawString("", new Font("宋体", 15), Brushes.Black, new Point(e.PageBounds.Width / 2, 20), sf);//打印标题
sf.Alignment = StringAlignment.Center;//居中打印
//handle.DocumentPrint(dbgname);
//e.Graphics.DrawImage(memoryimage, 0, 0);
e.Graphics.DrawString("浙江师范大学杭州幼儿师范学院小天使服务部", new Font("宋体", 11, FontStyle.Regular), Brushes.Black, 200, 10);



e.Graphics.DrawString(label1.Text, new Font("宋体", 11, FontStyle.Regular), Brushes.Black, label1.Location.X - 30, label1.Location.Y);
Control[] ctr = new Control[] {label10, label11, label13, label2, label3, label4, label5, label6, label7, label8, label9 };
for (int i = 0; i < ctr.Length; i++)
e.Graphics.DrawString(ctr[i].Text, new Font("宋体", 11, FontStyle.Regular), Brushes.Black, ctr[i].Location.X + 50, ctr[i].Location.Y + 50);
Control[] ct = new Control[] { textBox1,textBox2,textBox3,textBox4,textBox5,comboBox1,combox1,combox3};
for (int i = 0; i < ct.Length; i++)
e.Graphics.DrawString(ct[i].Text, new Font("宋体", 11, FontStyle.Regular), Brushes.Black, ct[i].Location.X + 56, ct[i].Location.Y + 53);
Font tabelTextFont = new Font("宋体", 10);
if (dbgname.DataBindings != null)
{
int[] columnsWidth = new int[dbgname.Columns.Count];//得到所有列的个数
int[] columnsLeft = new int[dbgname.Columns.Count]; //
for (int c = 0; c < columnsWidth.Length - 1; c++)//得到列标题的宽度
{
columnsWidth[c] = dbgname.Columns[c].Width;//(int)e.Graphics.MeasureString(dbgname.Columns[c].HeaderText, tabelTextFont).Width;
}
for (int rowIndex = 0; rowIndex < dbgname.Rows.Count; rowIndex++)//rowindex当前行
{
for (int columnIndex = 0; columnIndex < dbgname.Columns.Count; columnIndex++)//当前列
{
int w = (int)e.Graphics.MeasureString(dbgname.Columns[columnIndex].Name, tabelTextFont).Width;
columnsWidth[columnIndex] = w > columnsWidth[columnIndex] ? w : columnsWidth[columnIndex];
}
}
int rowHidth = 20;
int tableLeft = 30;
int tableTop = 150;
columnsLeft[0] = tableLeft;
for (int i = 1; i