📄 reportformsprint.cs
字号:
{
Rectangle temp = new Rectangle( 55,startY,30,20 );
e.Graphics.DrawRectangle( blackPen ,temp );
if ( i < ReportForms.GetSelect( ).Count && count > j)
{
if( lvi != null )
{
e.Graphics.DrawString( GetString("性别",lvi),new Font("宋体",fontSize-2,System.Drawing.FontStyle.Regular),Brushes.Black,57 ,startY + 5 );
}
}
}
if ( i == 2 )
{
Rectangle temp = new Rectangle( 85,startY,60,20 );
e.Graphics.DrawRectangle( blackPen ,temp );
if ( i < ReportForms.GetSelect( ).Count && count > j)
{
if( lvi != null )
{
e.Graphics.DrawString( GetString("出生年月",lvi),new Font("宋体",fontSize-2,System.Drawing.FontStyle.Regular),Brushes.Black,87 ,startY + 5 );
}
}
}
if ( i == 3 )
{
Rectangle temp = new Rectangle( 145,startY,60,20 );
e.Graphics.DrawRectangle( blackPen ,temp );
if ( i < ReportForms.GetSelect( ).Count && count > j)
{
if( lvi != null )
{
e.Graphics.DrawString( GetString("层次",lvi),new Font("宋体",fontSize-2,System.Drawing.FontStyle.Regular),Brushes.Black,147 ,startY + 5 );
}
}
}
if ( i == 4 )
{
Rectangle temp = new Rectangle( 205,startY,70,20 );
e.Graphics.DrawRectangle( blackPen ,temp );
if ( i < ReportForms.GetSelect( ).Count && count > j)
{
if( lvi != null )
{
e.Graphics.DrawString( GetString("学历类型",lvi),new Font("宋体",fontSize-2,System.Drawing.FontStyle.Regular),Brushes.Black,207 ,startY + 5 );
}
}
}
if ( i == 5 )
{
Rectangle temp = new Rectangle( 275,startY,30,20 );
e.Graphics.DrawRectangle( blackPen ,temp );
if ( i < ReportForms.GetSelect( ).Count && count > j)
{
if( lvi != null )
{
e.Graphics.DrawString( GetString("学制",lvi),new Font("宋体",fontSize-2,System.Drawing.FontStyle.Regular),Brushes.Black,277 ,startY + 5 );
}
}
}
if ( i == 6 )
{
Rectangle temp = new Rectangle( 305,startY,70,20 );
e.Graphics.DrawRectangle( blackPen ,temp );
if ( i < ReportForms.GetSelect( ).Count && count > j)
{
if( lvi != null )
{
e.Graphics.DrawString( GetString("毕业结论",lvi),new Font("宋体",fontSize-2,System.Drawing.FontStyle.Regular),Brushes.Black,307 ,startY + 5 );
}
}
}
if ( i == 7 )
{
Rectangle temp = new Rectangle( 375,startY,70,20 );
e.Graphics.DrawRectangle( blackPen ,temp );
if ( i < ReportForms.GetSelect( ).Count && count > j)
{
if( lvi != null )
{
e.Graphics.DrawString( GetString("入学日期",lvi),new Font("宋体",fontSize-2,System.Drawing.FontStyle.Regular),Brushes.Black,377 ,startY + 5 );
}
}
}
if ( i == 8 )
{
Rectangle temp = new Rectangle( 445,startY,70,20 );
e.Graphics.DrawRectangle( blackPen ,temp );
if ( i < ReportForms.GetSelect( ).Count && count > j)
{
if( lvi != null )
{
e.Graphics.DrawString( GetString("毕业时间",lvi),new Font("宋体",fontSize-2,System.Drawing.FontStyle.Regular),Brushes.Black,447 ,startY + 5 );
}
}
}
if ( i == 9 )
{
Rectangle temp = new Rectangle( 515,startY,70,20 );
e.Graphics.DrawRectangle( blackPen ,temp );
if ( i < ReportForms.GetSelect( ).Count && count > j)
{
if( lvi != null )
{
e.Graphics.DrawString( GetString("录入人员",lvi),new Font("宋体",fontSize-2,System.Drawing.FontStyle.Regular),Brushes.Black,517 ,startY + 5 );
}
}
}
if ( i == 10 )
{
Rectangle temp = new Rectangle( 585,startY,70,20 );
e.Graphics.DrawRectangle( blackPen ,temp );
if ( i < ReportForms.GetSelect( ).Count && count > j)
{
if( lvi != null )
{
e.Graphics.DrawString( GetString("录入时间",lvi),new Font("宋体",fontSize-2,System.Drawing.FontStyle.Regular),Brushes.Black,587 ,startY + 5 );
}
}
}
if ( i == 11 )
{
Rectangle temp = new Rectangle( 655,startY,70,20 );
e.Graphics.DrawRectangle( blackPen ,temp );
if ( i < ReportForms.GetSelect( ).Count && count > j)
{
if( lvi != null )
{
e.Graphics.DrawString( GetString("审核结果",lvi),new Font("宋体",fontSize-2,System.Drawing.FontStyle.Regular),Brushes.Black,657 ,startY + 5 );
}
}
}
if ( i == 12 )
{
Rectangle temp = new Rectangle( 725,startY,120,20 );
e.Graphics.DrawRectangle( blackPen ,temp );
if ( i < ReportForms.GetSelect( ).Count && count > j)
{
if( lvi != null )
{
e.Graphics.DrawString( GetString("专业名称",lvi),new Font("宋体",fontSize-2,System.Drawing.FontStyle.Regular),Brushes.Black,727 ,startY + 5 );
}
}
}
if ( i == 13 )
{
Rectangle temp = new Rectangle( 845,startY,120,20 );
e.Graphics.DrawRectangle( blackPen ,temp );
if ( i < ReportForms.GetSelect( ).Count && count > j)
{
if( lvi != null )
{
e.Graphics.DrawString( GetString("院校名称",lvi),new Font("宋体",fontSize-2,System.Drawing.FontStyle.Regular),Brushes.Black,847 ,startY + 5 );
}
}
}
if( i == 14 )
{
Rectangle temp = new Rectangle( 965,startY,140,20 );
e.Graphics.DrawRectangle( blackPen ,temp );
if ( i < ReportForms.GetSelect( ).Count && count > j)
{
if( lvi != null )
{
e.Graphics.DrawString( GetString("证书编号",lvi),new Font("宋体",fontSize-2,System.Drawing.FontStyle.Regular),Brushes.Black,967 ,startY + 5 );
}
}
}
}
startY += 20;
tempIndex++;
}
if ( PageCount > CurrentPage )
{
CurrentPage++;
StartIndex = StartIndex + 34;
e.HasMorePages = true;
}
else
{
e.HasMorePages = false;
}
}
}
/// <summary>
/// 返回要打印的数据
/// </summary>
/// <param name="coulumnName">选择的列名</param>
/// <param name="lvi">ListViewitem</param>
/// <returns>数据</returns>
private string GetString( string columnName, ListViewItem lvi)
{
if( columnName == "姓名" )
{
return lvi.SubItems[1].Text;
}
else if( columnName == "性别" )
{
return lvi.SubItems[2].Text;
}
else if( columnName == "出生年月" )
{
return lvi.SubItems[3].Text;
}
else if( columnName == "层次" )
{
return lvi.SubItems[4].Text;
}
else if( columnName == "学历类型" )
{
return lvi.SubItems[5].Text;
}
else if( columnName == "学制" )
{
return lvi.SubItems[6].Text;
}
else if( columnName == "院校名称" )
{
return lvi.SubItems[7].Text;
}
else if( columnName == "专业名称" )
{
return lvi.SubItems[8].Text;
}
else if( columnName == "毕业结论" )
{
return lvi.SubItems[9].Text;
}
else if( columnName == "入学日期" )
{
return lvi.SubItems[10].Text;
}
else if( columnName == "毕业时间" )
{
return lvi.SubItems[11].Text;
}
else if( columnName == "证书编号" )
{
return lvi.SubItems[12].Text;
}
else if( columnName == "录入人员" )
{
return lvi.SubItems[13].Text;
}
else if( columnName == "录入时间" )
{
return lvi.SubItems[14].Text;
}
else if( columnName == "审核结果" )
{
return lvi.SubItems[15].Text;
}
else
{
return "";
}
}
private void comboBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
if(comboBox1.SelectedIndex == 0)
{
printPreviewControl1.Zoom = 2.00;
}
if(comboBox1.SelectedIndex == 1)
{
printPreviewControl1.Zoom = 1.50;
}
if(comboBox1.SelectedIndex == 2)
{
printPreviewControl1.Zoom = 1.00;
}
if(comboBox1.SelectedIndex == 3)
{
printPreviewControl1.Zoom = 0.75;
}
if(comboBox1.SelectedIndex == 4)
{
printPreviewControl1.Zoom = 0.50;
}
if(comboBox1.SelectedIndex == 5)
{
printPreviewControl1.Zoom = 0.30;
}
if(comboBox1.SelectedIndex == 6)
{
printPreviewControl1.Zoom = 0.25;
}
}
private void button1_Click(object sender, System.EventArgs e)
{
PrintConfig.ShowDialog( );
}
private void button2_Click(object sender, System.EventArgs e)
{
CurrentPage = 1;
StartIndex = 0;
try
{
PrintMachine.Print();
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
private void printPreviewControl1_Click(object sender, System.EventArgs e)
{
}
private void ReportFormsPrint_Load(object sender, System.EventArgs e)
{
if ( ReportForms.hexiang == true )
{
PrintMachine.DefaultPageSettings.Landscape = true;
PageCount = QueryByNewData.printList.Items.Count / 34 + 1;
}
else
{
PageCount = QueryByNewData.printList.Items.Count / 32 + 1;
}
}
private void PrintMachine_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -