⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 previewdialog.cs

📁 为湖北省教委、湖北省就业指导中心订做的学历查询系统
💻 CS
📖 第 1 页 / 共 3 页
字号:
					e.Graphics.DrawString(result,notifyFont,textColor,resultRect);
				}
				else
				{
					string printDegreeKind = InputData.trans.degreeKind.Trim();
					
					string printDegree = InputData.trans.degree.Trim();

					if(printDegreeKind.Length<8)
					{ 
						if(printDegreeKind.Length == 7)
						{
							printDegreeKind = printDegreeKind;
						}
						if(printDegreeKind.Length == 6)
						{
							printDegreeKind =  printDegreeKind;
						}
						if(printDegreeKind.Length == 5)
						{
							printDegreeKind = " " + printDegreeKind+"  ";
						}
						if(printDegreeKind.Length == 4)
						{
							printDegreeKind = " " + printDegreeKind+"    ";
						}
						if(printDegreeKind.Length == 3)
						{
							printDegreeKind = " " + printDegreeKind+"      ";
						}
						if(printDegreeKind.Length == 2)
						{
							printDegreeKind = " " + printDegreeKind+"        ";
						}
					}
					
					if(printDegree.Length<9)
					{
						if(printDegree.Length == 5)
						{
							printDegree = printDegree + "      ";
						}
						if(printDegree.Length == 6)
						{
							printDegree = " "+printDegree + "    ";
						}
						if(printDegree.Length == 4)
						{
							printDegree =  " "+printDegree + "        ";
						}
						if(printDegree.Length == 3)
						{
							printDegree =  " "+printDegree + "          ";
						}
						if(printDegree.Length == 2)
						{
							printDegree =  " "+printDegree + "            ";
						}

					}


					
					
					int textStartY = e.PageBounds.Height / 4;	//打印文本的垂直位置
					int textStartX = 20;	//打印文本的横向位置/////////////////////////////////
					int notifyInfoTextY = e.PageBounds.Height /5;
					int textFirstStartX = 1;//第一行左上角X 左上角坐标偏移量/////////////////
					int textFirstStartY = e.PageBounds.Height/9;
					int noticeStartX = e.PageBounds.Width/5;
					int noticeStartY = e.PageBounds.Height/3;
			
					//设置文本各部分的字体
					Font firstLineFont = new Font("宋体",fontSize+9,System.Drawing.FontStyle.Bold);////////////////////////

					Font notifyFont = new Font("宋体", fontSize+4);	
					Font notifyMsgFont = new Font("宋体", fontSize +4);
					Font notifyResultFont = new Font("隶书", fontSize + 4);
					Font noticeFont = new Font("宋体",fontSize +3,System.Drawing.FontStyle.Bold);
					Font noticeTextFont = new Font("宋体",12);
			
			
			
					//设置文本的内容
			

					string notifyInfoText = "           " + InputPrint.reportNum ;
					string notifyInfoText2 = "           " +  InputPrint.reportData;
			
					string lineText = "您申请查询的:";

				
				
					string notifyText ="  "+ "姓名:" + InputData.trans.name +",性别:"+ InputData.trans.sex +",生于"+ InputData.trans.birthYear +"年"+ InputData.trans.birthMonth +"月"+ InputData.trans.birthDay +"日," + InputData.trans.graYear +"年"+ InputData.trans.graMonth+"月";
					
					string notifyText2 =  "取得的" + InputData.trans.schName+","+ InputData.trans.schCourse +"专业,"+"证书编";
					string notifyText3 =  "号为"+"  "+InputData.trans.degreeNum +" " +"的" +printDegreeKind + printDegree ;
					string notifyText4 = "毕业证书。";
				
				
					string result = "查询结果如下:";
					string notifyResultText = "经省市、自治区或高校学籍学历主管部门核实,查无此人。";
							
			
					//获取文本所占区域的大小
			

					SizeF notifyInfoSize = e.Graphics.MeasureString(notifyInfoText, notifyFont);
					SizeF notifyInfoText2Size = e.Graphics.MeasureString(notifyInfoText2, notifyFont);
					SizeF  lineTextSize = e.Graphics.MeasureString(lineText, notifyMsgFont, e.MarginBounds.Width);
				
				
					SizeF notifyMsgSize = e.Graphics.MeasureString(notifyText, notifyMsgFont, e.MarginBounds.Width);
					SizeF notifyMsg2Size = e.Graphics.MeasureString(notifyText2, notifyMsgFont, e.MarginBounds.Width);
					SizeF notifyMsg3Size = e.Graphics.MeasureString(notifyText3, notifyMsgFont, e.MarginBounds.Width);
					SizeF notifyMsg4Size = e.Graphics.MeasureString(notifyText4, notifyMsgFont, e.MarginBounds.Width);
				
				
	
					SizeF resultSize = e.Graphics.MeasureString(result,notifyFont);
		
			
			     
			
					//设置文本绘制的区域

				
					RectangleF notifyInfoTextRect  = new RectangleF(e.MarginBounds.X + textStartX, notifyInfoTextY + notifyInfoText2Size.Height +72  + 40-5, e.MarginBounds.Width, 400);//---
					RectangleF notifyInfoText2Rect = new RectangleF(e.MarginBounds.X + textStartX, notifyInfoTextY + notifyInfoText2Size.Height +114 + 40-5, e.MarginBounds.Width, 400);//---
				
				
					RectangleF  lineTextRect = new RectangleF(e.MarginBounds.X + textStartX, textStartY + notifyInfoSize.Height + 108+87-37+4, e.MarginBounds.Width, 400);
				
					RectangleF       msgRect  = new RectangleF(e.MarginBounds.X + textStartX, textStartY + notifyInfoSize.Height + 108+87+4, e.MarginBounds.Width, 400);
					RectangleF       msgRect2  = new RectangleF(e.MarginBounds.X + textStartX, textStartY + notifyMsg2Size.Height + 108+87+37+4, e.MarginBounds.Width, 400);
					RectangleF        msgRect3  = new RectangleF(e.MarginBounds.X + textStartX, textStartY + notifyMsg3Size.Height + 108+87+37+37+4, e.MarginBounds.Width, 400);
					RectangleF        msgRect4  = new RectangleF(e.MarginBounds.X + textStartX, textStartY + notifyMsg4Size.Height + 108+87+37+37+37+4, e.MarginBounds.Width, 400);
				
					RectangleF ResultRect =       new RectangleF(e.MarginBounds.X + textStartX, textStartY + notifyMsgSize.Height + 108+87+37+37+37+37+37+4, e.MarginBounds.Width, 400);
					RectangleF resultRect =       new RectangleF(e.MarginBounds.X + textStartX, textStartY + notifyMsgSize.Height + 108+87+37+37+37+37+4,e.MarginBounds.Width,400);

			

  

					//设置文本的字体颜色
					SolidBrush textColor = new SolidBrush(Color.Black);
			
					//绘制文本
					e.Graphics.DrawString(lineText,notifyFont,textColor,lineTextRect);/////////////////
			
				
					e.Graphics.DrawString(notifyInfoText, notifyFont, textColor, notifyInfoTextRect);//---
					e.Graphics.DrawString(notifyInfoText2, notifyFont, textColor, notifyInfoText2Rect);//---

					e.Graphics.DrawString(notifyText, notifyMsgFont, textColor, msgRect);
					e.Graphics.DrawString(notifyText2, notifyMsgFont, textColor, msgRect2);
					e.Graphics.DrawString(notifyText3, notifyMsgFont, textColor, msgRect3);
					e.Graphics.DrawString(notifyText4, notifyMsgFont, textColor, msgRect4);
				
				
					e.Graphics.DrawString(notifyResultText, notifyResultFont, textColor, ResultRect);
					e.Graphics.DrawString(result,notifyFont,textColor,resultRect);

				}

			}
		  
		}

	
	

		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 pictureBox1_Click(object sender, System.EventArgs e)
		{
			try
			{
				//private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
			
				
				//e.GetType();
				printPreviewControl1.Document.Print();
				
			}
			catch(Exception ex)
			{
				MessageBox.Show(ex.ToString());
			}
		}

		private void pictureBox1_MouseEnter(object sender, System.EventArgs e)
		{
			pictureBox1.Image = Image.FromFile( "img\\button-打印02.GIF" );
		}

		private void pictureBox1_MouseLeave(object sender, System.EventArgs e)
		{
			 pictureBox1.Image = Image.FromFile( "img\\button-打印01.GIF" );
		}

		private void pictureBox2_Click(object sender, System.EventArgs e)
		{
			pageSetupDialog1.ShowDialog();
		}

		private void pictureBox2_MouseEnter(object sender, System.EventArgs e)
		{
			 pictureBox2.Image = Image.FromFile( "img\\button-打印设置02.GIF" );
		}

		private void pictureBox2_MouseLeave(object sender, System.EventArgs e)
		{
			 pictureBox2.Image = Image.FromFile( "img\\button-打印设置01.GIF" );
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -