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

📄 barcodepdf417.cs

📁 C# 製做的PDF417二維條碼生成程序,可根據輸入的資料自動生成二維條碼
💻 CS
📖 第 1 页 / 共 5 页
字号:
			{				return this.m_BackColor;			}			set			{				this.m_BackColor = value;				base.Invalidate ();			}		}				[Category ("PDF417")]		[DefaultValue (enumBorderStyle.bsNoBorder)]		public enumBorderStyle BorderStyle				{			get			{				return this.m_BorderStyle;			}			set			{				this.m_BorderStyle = value;				base.Invalidate ();			}		}				[Category ("PDF417")]		public Metafile ImageData				{			get			{				Metafile theMetafile1;				IntPtr theIntPtr1;				this.g = base.CreateGraphics ();				theIntPtr1 = this.g.GetHdc ();				theMetafile1 = new Metafile ("", theIntPtr1);				this.g.ReleaseHdc (theIntPtr1);				this.g.Dispose ();				this.g = Graphics.FromImage (theMetafile1);				this.DoubleDraw ();				this.g.Dispose ();				return theMetafile1;			}		}				[Category ("PDF417")]		[DefaultValue ("aTiRuZ")]		public string Data				{			get			{				return this.m_Data;			}			set			{				this.m_Data = value;				base.Invalidate ();			}		}				[DefaultValue (0.019F)]		[Category ("PDF417")]		public float NarrowBarWidth				{			get			{				return this.m_ModuleWidth;			}			set			{				this.m_ModuleWidth = value;				base.Invalidate ();			}		}				[DefaultValue (enumOrientation.or0)]		[Category ("PDF417")]		public enumOrientation Orientation				{			get
			{
				return m_Orientation;
			}
			set
			{
				m_Orientation = value;
				base.Invalidate();
				return;
			}		}				[Category ("PDF417")]		[DefaultValue (13)]		public short PDFColumns				{			get
			{
				return m_Columns;
			}
			set
			{
				m_Columns = value;
				base.Invalidate();
				return;
			}		}				[DefaultValue (30)]		[Category ("PDF417")]		public short PDFRows				{			get
			{
				return m_Rows;
			}
			set
			{
				m_Rows = value;
				base.Invalidate();
				return;
			}		}				[Description ("Truncate Symbol")]		[Category ("PDF417")]		[DefaultValue (false)]		public bool TruncatedSymbol				{			get
			{
				return m_TruncatedSymbol;
			}
			set
			{
				m_TruncatedSymbol = value;
				base.Invalidate();
				return;
			}		}				[Category ("PDF417")]		[DefaultValue (enumSecurity.seLevel_5)]		public enumSecurity ErrorCorrectionLevel				{			get
			{
				return m_ErrorCorrectionLevel;
			}
			set
			{
				m_ErrorCorrectionLevel = value;
				m_SecurityLevel = ((short)(m_ErrorCorrectionLevel));
				base.Invalidate();
				return;
			}		}				[Category ("PDF417")]		[DefaultValue (4F)]		[Description ("XtoYRatio")]		public float XtoYRatio				{			get
			{
				return m_XtoYRatio;
			}
			set
			{
				m_XtoYRatio = value;
				base.Invalidate();
				return;
			}		}				#endregion				#region Methods				private void InitializeComponent ()				{			// 
			// BarcodePDF417
			// 
			this.Name = "BarcodePDF417";

		}				public void SaveAsImage (string FileName, ImageFormat ImgFormat)				{			Bitmap theBitmap1;			theBitmap1 = new Bitmap (base.Width, base.Height, PixelFormat.Format24bppRgb);			this.g = Graphics.FromImage (theBitmap1);			this.DoubleDraw ();			theBitmap1.Save (FileName, ImgFormat);			this.g.Dispose ();			theBitmap1.Dispose ();		}				public void Render (Graphics renderG, Rectangle areaRc)				{			this.m_WidthPixels = ((short) areaRc.Width);			this.m_HeightPixels = ((short) areaRc.Height);			this.m_LeftPixels = ((short) areaRc.Left);			this.m_TopPixels = ((short) areaRc.Top);			this.g = renderG;			try			{				try				{					this.DoubleDraw ();				}				catch (Exception)				{				}			}			finally			{				GC.Collect ();			}		}				private void GeneralDraw ()				{			int theInt32_2;			short theInt16_3;			short theInt16_2;			short theInt16_1;			string theString1;			int theInt32_1;			if (! this.m_FirstDraw)			{				this.g.FillRectangle (this.m_BackBrush, ((int) this.m_LeftPixels), ((int) this.m_TopPixels), ((int) this.m_WidthPixels), ((int) this.m_HeightPixels));			}			if ((this.m_Orientation == enumOrientation.or0) || (this.m_Orientation == enumOrientation.or180))			{				this.m_CurrX = this.m_LeftMargainPixels;				this.m_CurrY = this.m_TopMargainPixels;			}			else			{				this.m_CurrX = this.m_TopMargainPixels;				this.m_CurrY = this.m_LeftMargainPixels;			}			if (this.m_FirstDraw)			{				this.BinaryCompact ();			}			theInt32_1 = 0;			theString1 = null;			for (theInt16_1 = 0; (theInt16_1 < this.m_RuntimeRows); theInt16_1 = ((short) (theInt16_1 + 1)))			{				if ((this.m_Orientation == enumOrientation.or0) || (this.m_Orientation == enumOrientation.or180))				{					this.m_CurrX = this.m_LeftMargainPixels;				}				else				{					this.m_CurrX = this.m_TopMargainPixels;				}				theInt16_2 = ((short) (theInt16_1 * this.m_ModuleHeightPixels));				theInt16_3 = ((short) (- (((this.m_RuntimeRows - theInt16_1) - 1) * this.m_ModuleHeightPixels)));				theString1 = this.GetPattern (130728);				this.DrawChar ("bwbwbwbw", theString1, theInt16_2, theInt16_3);				theString1 = this.GetPattern (BarcodePDF417.PDF417_BITS[(theInt16_1 % 3), ((int) this.GetRowStart (theInt16_1))]);				this.DrawChar ("bwbwbwbw", theString1, theInt16_2, theInt16_3);				for (theInt32_2 = 0; (theInt32_2 < this.m_Columns); theInt32_2 += 1)				{					theString1 = this.GetPattern (BarcodePDF417.PDF417_BITS[(theInt16_1 % 3), ((int) this.m_EncodedData[theInt32_1++])]);					this.DrawChar ("bwbwbwbw", theString1, theInt16_2, theInt16_3);				}				if (! this.m_TruncatedSymbol)				{					theString1 = this.GetPattern (BarcodePDF417.PDF417_BITS[(theInt16_1 % 3), ((int) this.GetRowEnd (theInt16_1))]);					this.DrawChar ("bwbwbwbw", theString1, theInt16_2, theInt16_3);					this.DrawChar ("bwbwbwbwb", "711311121", theInt16_2, theInt16_3);				}				else				{					this.DrawChar ("bw", "11", theInt16_2, theInt16_3);				}				this.m_CurrY = ((short) (this.m_CurrY + this.m_ModuleHeightPixels));			}		}				private void DoubleDraw ()				{			this.g.PageUnit = GraphicsUnit.Pixel;			if ((this.m_Orientation == enumOrientation.or0) || (this.m_Orientation == enumOrientation.or180))			{				this.m_ResX = this.g.DpiX;				this.m_ResY = this.g.DpiY;			}			else			{				this.m_ResX = this.g.DpiY;				this.m_ResY = this.g.DpiX;			}			if (((double) this.m_ModuleWidth) != 0D)			{				this.m_NarrowBarPixels = ((short) (((double) (this.m_ResX * this.m_ModuleWidth)) / 2.54D));			}			this.m_ModuleHeightPixels = ((short) (((double) ((this.m_XtoYRatio * this.m_ResX) * this.m_ModuleWidth)) / 2.54D));			this.m_WideBarPixels = ((short) (((double) this.m_NarrowBarPixels) * 2D));			if (this.m_NarrowBarPixels <= 0)			{				this.m_NarrowBarPixels = 1;			}			if (this.m_WideBarPixels <= 1)			{				this.m_WideBarPixels = ((short) (((double) this.m_NarrowBarPixels) * 2D));			}			this.m_TopMargainPixels = 0;			this.m_LeftMargainPixels = 0;			this.m_FirstDraw = true;			this.m_BackBrush = new SolidBrush (this.m_BackColor);			this.m_BarBrush = new SolidBrush (this.m_BarColor);			this.GeneralDraw ();			this.m_BarHeightPixels = this.m_CurrY;			if ((this.m_Orientation == enumOrientation.or0) || (this.m_Orientation == enumOrientation.or180))			{				this.m_TopMargainPixels = ((short) ((this.m_HeightPixels - this.m_CurrY) / 2));				this.m_LeftMargainPixels = ((short) ((this.m_WidthPixels - this.m_CurrX) / 2));			}			else			{				this.m_LeftMargainPixels = ((short) ((this.m_WidthPixels - this.m_CurrY) / 2));				this.m_TopMargainPixels = ((short) ((this.m_HeightPixels - this.m_CurrX) / 2));			}			if (this.m_LeftMargainPixels < 0)			{				this.m_LeftMargainPixels = 0;			}			if (this.m_TopMargainPixels < 0)			{				this.m_TopMargainPixels = 0;			}			this.m_FirstDraw = false;			this.GeneralDraw ();			if (this.m_BorderStyle == enumBorderStyle.bsDashBorder)			{				this.DrawBorder (false);			}			else if (this.m_BorderStyle == enumBorderStyle.bsSolidBorder)			{				this.DrawBorder (true);			}			this.m_BackBrush.Dispose ();			this.m_BarBrush.Dispose ();		}				private int FindCoef (int index)		

⌨️ 快捷键说明

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