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

📄 searchpreview.cs

📁 为湖北省教委、湖北省就业指导中心订做的学历查询系统
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace WindowsApplication3
{
	/// <summary>
	/// SearchPreview 的摘要说明。
	/// </summary>
	public class SearchPreview : System.Windows.Forms.Form
	{
		private float fontSize = 12; 
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.ComboBox comboBox1;
		private System.Windows.Forms.ComboBox comboBox2;
		private System.Windows.Forms.PrintPreviewControl printPreviewControl2;
		private System.Drawing.Printing.PrintDocument printDocument1;
		private System.Windows.Forms.PageSetupDialog pageSetupDialog1;
		private System.Windows.Forms.PictureBox pictureBox1;
		private System.Windows.Forms.PictureBox pictureBox2;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public SearchPreview()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(SearchPreview));
			this.label1 = new System.Windows.Forms.Label();
			this.comboBox1 = new System.Windows.Forms.ComboBox();
			this.comboBox2 = new System.Windows.Forms.ComboBox();
			this.printPreviewControl2 = new System.Windows.Forms.PrintPreviewControl();
			this.printDocument1 = new System.Drawing.Printing.PrintDocument();
			this.pageSetupDialog1 = new System.Windows.Forms.PageSetupDialog();
			this.pictureBox1 = new System.Windows.Forms.PictureBox();
			this.pictureBox2 = new System.Windows.Forms.PictureBox();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(-224, 451);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(108, 24);
			this.label1.TabIndex = 8;
			this.label1.Text = "请选择预览的大小";
			// 
			// comboBox1
			// 
			this.comboBox1.Items.AddRange(new object[] {
														   "200%",
														   "150%",
														   "100%",
														   "75%",
														   "50%",
														   "25%"});
			this.comboBox1.Location = new System.Drawing.Point(-96, 451);
			this.comboBox1.Name = "comboBox1";
			this.comboBox1.Size = new System.Drawing.Size(92, 20);
			this.comboBox1.TabIndex = 7;
			// 
			// comboBox2
			// 
			this.comboBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
			this.comboBox2.Items.AddRange(new object[] {
														   "200%",
														   "150%",
														   "100%",
														   "75%",
														   "50%",
														   "30%",
														   "25%"});
			this.comboBox2.Location = new System.Drawing.Point(64, 512);
			this.comboBox2.Name = "comboBox2";
			this.comboBox2.Size = new System.Drawing.Size(88, 20);
			this.comboBox2.TabIndex = 12;
			this.comboBox2.Text = "预览比例";
			this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged);
			// 
			// printPreviewControl2
			// 
			this.printPreviewControl2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.printPreviewControl2.AutoZoom = false;
			this.printPreviewControl2.Document = this.printDocument1;
			this.printPreviewControl2.Location = new System.Drawing.Point(8, 8);
			this.printPreviewControl2.Name = "printPreviewControl2";
			this.printPreviewControl2.Size = new System.Drawing.Size(658, 488);
			this.printPreviewControl2.TabIndex = 20;
			this.printPreviewControl2.Zoom = 0.75;
			// 
			// printDocument1
			// 
			this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
			// 
			// pageSetupDialog1
			// 
			this.pageSetupDialog1.Document = this.printDocument1;
			// 
			// pictureBox1
			// 
			this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
			this.pictureBox1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBox1.BackgroundImage")));
			this.pictureBox1.Location = new System.Drawing.Point(288, 512);
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new System.Drawing.Size(56, 24);
			this.pictureBox1.TabIndex = 21;
			this.pictureBox1.TabStop = false;
			this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
			this.pictureBox1.MouseEnter += new System.EventHandler(this.pictureBox1_MouseEnter);
			this.pictureBox1.MouseLeave += new System.EventHandler(this.pictureBox1_MouseLeave);
			// 
			// pictureBox2
			// 
			this.pictureBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
			this.pictureBox2.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox2.Image")));
			this.pictureBox2.Location = new System.Drawing.Point(184, 512);
			this.pictureBox2.Name = "pictureBox2";
			this.pictureBox2.Size = new System.Drawing.Size(72, 24);
			this.pictureBox2.TabIndex = 22;
			this.pictureBox2.TabStop = false;
			this.pictureBox2.Click += new System.EventHandler(this.pictureBox2_Click);
			this.pictureBox2.MouseEnter += new System.EventHandler(this.pictureBox2_MouseEnter);
			this.pictureBox2.MouseLeave += new System.EventHandler(this.pictureBox2_MouseLeave);
			// 
			// SearchPreview
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.BackColor = System.Drawing.SystemColors.ActiveCaptionText;
			this.ClientSize = new System.Drawing.Size(672, 558);
			this.Controls.Add(this.pictureBox2);
			this.Controls.Add(this.pictureBox1);
			this.Controls.Add(this.printPreviewControl2);
			this.Controls.Add(this.comboBox2);
			this.Controls.Add(this.comboBox1);
			this.Controls.Add(this.label1);
			this.Name = "SearchPreview";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "打印预览";
			this.Load += new System.EventHandler(this.SearchPreview_Load);
			this.ResumeLayout(false);

		}
		#endregion

		private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
		{
			if(searchprint.reportKindS == "yes")
			{
				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 + 3);
				Font noticeFont = new Font("宋体",fontSize +3,System.Drawing.FontStyle.Bold);
				Font noticeTextFont = new Font("宋体",12);
			
			
			
				//设置文本的内容
			
				string notifyInfoText = "           " + searchprint.reportNumS ;
				string notifyInfoText2 = "           " +  searchprint.reportDataS;
				/////////////////////////////////////////////////
			
				string notifyText ="  "+ "姓名:" + InputData.trans.name  + ",性别:"+InputData.trans.sex + ",生于"+ InputData.trans.birthYear+ "年" +InputData.trans.birthMonth + "月" + InputData.trans.birthDay +"日,"+InputData.trans.schYear+" 年就读";
					

			 
				string notifyText2 = "于" + InputData.trans.schName +","+ InputData.trans.schCourse +"专业,学制"+ InputData.trans.termYear+"年," ;
				string notifyText3 ="于"+InputData.trans.graYear +"年获得"+ InputData.trans.degreeKind + InputData.trans.degree +"毕业证";
				string notifyText4 = "书,证书编号:"+ InputData.trans.degreeNum + "。" + "(报告编号:" + searchprint.reportNumS + ")";


			
			
				//获取文本所占区域的大小
			

				SizeF notifyInfoSize = e.Graphics.MeasureString(notifyInfoText, notifyFont);
				SizeF notifyInfoText2Size = e.Graphics.MeasureString(notifyInfoText2, notifyFont);////////

				SizeF notifyMsgSize = e.Graphics.MeasureString(notifyText, notifyMsgFont, e.MarginBounds.Width);

			     
			
				//设置文本绘制的区域
				
			 
                
				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 msgRect = new RectangleF(e.MarginBounds.X + textStartX, textStartY + notifyInfoSize.Height +108+87, e.MarginBounds.Width, 400);
				RectangleF msgRect2 = new RectangleF(e.MarginBounds.X + textStartX, textStartY + notifyInfoSize.Height +108+87+44, e.MarginBounds.Width, 400);
				RectangleF msgRect3 = new RectangleF(e.MarginBounds.X + textStartX, textStartY + notifyInfoSize.Height +108+87+44+44, e.MarginBounds.Width, 400);
				RectangleF msgRect4 = new RectangleF(e.MarginBounds.X + textStartX, textStartY + notifyInfoSize.Height +108+87+44+44+44, e.MarginBounds.Width, 400);
				
				RectangleF ResultRect = new RectangleF(e.MarginBounds.X + textStartX, textStartY + notifyMsgSize.Height + notifyInfoSize.Height + 20, e.MarginBounds.Width, 100);




				//设置文本的字体颜色
				SolidBrush textColor = new SolidBrush(Color.Black);
			
				//绘制文本
				
			
				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);

				
				
			}
			
			if(searchprint.reportKindS == "no")//选择打印无此人的情况
			{
				if((InputData.trans.degreeKind.Length == 8)||(InputData.trans.degree.Length == 9))
				{
					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 = "           " + searchprint.reportNumS ;
					string notifyInfoText2 = "           " +  searchprint.reportDataS;
			
					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+"  " + "的" +"    " +InputData.trans.degreeKind + "      " ;
					string notifyText4 = InputData.trans.degree+"  "+"毕业证书。";
				
				
					string result = "查询结果如下:";
					string notifyResultText = "经省市、自治区或高校学籍学历主管部门核实,查无此人。";
							
			
					//获取文本所占区域的大小

⌨️ 快捷键说明

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