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

📄 barcodedraw2.htm

📁 非常实用的条形码制作工具
💻 HTM
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML DIR="LTR"><HEAD>
<META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
<TITLE>Draw Method (2)</TITLE></HEAD>
<body topmargin="0">
<font size="-1">&nbsp;Barcode .Net Class Library</font>
<H3>Draw Method (2)</H3>
<P>Draws a barcode to a Graphics object. This is more flexible than <a href="barcodeDraw1.htm">Draw (1)</a> but less flexible than <a href="barcodeDraw3.htm">Draw(3)</a>. Applies to <A HREF="barcodeClass.htm">Barcode</A>, 
<A HREF="barcodeControl.htm">BarcodeControl</A>
or <A HREF="barcodeImage.htm">BarcodeImage</A>.</P>

<PRE><font size="-1">[Visual&nbsp;Basic]</font>
<B>Public Sub Draw(</B> _
&nbsp;&nbsp;&nbsp;<b>ByVal</b> <i>g</i> <b>As</b> Graphics, _
&nbsp;&nbsp;&nbsp;<b>ByVal</b> <i>rect</i> <b>As</b> RectangleF, _
&nbsp;&nbsp;&nbsp;<b>ByVal</b> <i>unit</i> <b>As</b> GraphicsUnit, _
&nbsp;&nbsp;&nbsp;<b>ByVal</b> <i>scale</i> <b>As</b> float, _
&nbsp;&nbsp;&nbsp;<b>ByVal</b> <i>extraFlags</i> <b>As</b> <a href="drawFlagsEnum.htm">BarcodeDrawFlags</a>, _
&nbsp;&nbsp;&nbsp;<b>ByVal</b> <i>textOnlyString</i> <b>As</b> String _
<B>)</B>

<font size="-1">[C#]</font>
<B>public void Draw(</B>
&nbsp;&nbsp;&nbsp;Graphics <i>g</i>, 
&nbsp;&nbsp;&nbsp;RectangleF <i>rect</i>, 
&nbsp;&nbsp;&nbsp;GraphicsUnit <i>unit</i>, 
&nbsp;&nbsp;&nbsp;float <i>scale</i>, 
&nbsp;&nbsp;&nbsp;<a href="drawFlagsEnum.htm">BarcodeDrawFlags</a> <i>extraFlags</i>, 
&nbsp;&nbsp;&nbsp;string <i>textOnlyString</i>
<B>);</B>
</PRE>

<H4>Parameters</H4>
<DL><DT><I>g</I></DT>
<DD>Graphics object to which the barcode is to be drawn.
</DD></DL>
<DL><DT><I>rect</I></DT>
<DD>Location and size of the barcode, in units given by <i>unit</i> and scaled by <i>scale</i>.
<i>rect.width</i> may be either that of the narrowest bar of the
barcode or that the entire barcode, depending on whether the <b>BarcodeDrawflags.WidthPerModule</b> bit is set in
the <i>extraFlags</i> parameter.
</DD></DL>
<DL><DT><I>unit</I></DT>
<DD>A System.Drawing.GraphicsUnit enumeration that specifies the unit used by <i>rect</i> and is
scaled by <i>scale</i>.
<table border="1" cellspacing="0">
<tr><td align="center" bgcolor="#cccccc">Value</td><td align="center" bgcolor="#cccccc">Meaning</td></tr>
<tr><td><tt>Display</tt></td><td>Specifies 1/75 inch as the unit of measure.</td></tr>
<tr><td><tt>Document</tt></td><td>Specifies the document unit (1/300 inch) as the unit of measure.</td></tr>
<tr><td><tt>Inch</tt></td><td>Specifies the inch as the unit of measure.</td></tr>
<tr><td><tt>Millimeter</tt></td><td>Specifies the millimeter as the unit of measure.</td></tr>
<tr><td><tt>Pixel</tt></td><td>Specifies a device pixel as the unit of measure.</td></tr>
<tr><td><tt>Point</tt></td><td>Specifies a printer's point (1/72 inch) as the unit of measure.</td></tr>
<tr><td><tt>World</tt></td><td>Specifies the world unit as the unit of measure.</td></tr>
</table>
<p>
If <tt>World</tt> is specified, then the current PageUnit of <i>g</i> will be used and <i>scale</i> ignored.
</DD></DL>
<DL><DT><I>scale</I></DT>
<DD>Specifies how <i>unit</i> is to be scaled. Ignored if <tt>World</tt> is specified for <i>unit</i>.
</DD></DL>
<DL><DT><I>extraFlags</I></DT>
<DD>A <a href="drawFlagsEnum.htm">BarcodeDrawFlags</a> enumeration specifying how the barcode is to be drawn, complementing the current property settings. Only the subset of the BarcodeDrawFlags members (cf. table below) that have no corresponding properties can be used and will be effective.
<table cellspacing="0" border="1">

<TR>
<TH bgcolor="#cccccc">Member Name</TH>
<TH bgcolor="#cccccc">Description</TH>
</TR>

<TR>
<TD><tt>NoDrawBackground</tt></TD>
<TD>Do not draw the background.</TD>
</TR>

<TR>
<TD><tt>CalculateSizeOnly</tt></TD>
<TD>Do not actually draw the barcode; calculate the barcode position and size only.</TD>
</TR>

<TR>
<TD><tt>Clip</tt></TD>
<TD>Clip the barcode to the target rectangle.</TD>
</TR>

<TR>
<TD><tt>PaintWholeRect</tt></TD>
<TD>Paint the background of the entire target rectangle even if the actual barcode 
will only take up part of it.</TD>
</TR>

<TR>
<TD><tt>DrawTextOnly</tt></TD>
<TD>Draw only the barcode data, not the barcode.</TD>
</TR>

<TR>
<TD><tt>DrawBackgroundOnly</tt></TD>
<TD>Draw only the background, not the barcode.</TD>
</TR>

<TR>
<TD><tt>WidthPerModule</tt></TD>
<TD>Indicates that the width parameter specifies the width of the thinnest barcode bar
rather than that of the barcode.</TD>
</TR>

<TR>
<TD><tt>NoRestoreGraphicsState</tt></TD>
<TD>Do not restore the state of the Graphics object after drawing.</TD>
</TR>

</table>
</DD></DL>
<DL><DT><I>textOnlyString</I></DT>
<DD>If not null, only this string will be drawn instead of a barcode image.
</DD></DL>

<H4 class="dtH4">Remarks</H4>
<p>Both <i>unit</i> and <i>scale</i> together specify the <i>real unit </i> for the
<i>rect</i> parameter. This is true for general .Net graphics and GDI+ programming as well.
For example, GraphicsUnit.Inch for <i>unit</i> and 0.01 for <i>scale</i> would specify
the unit of measure of 0.01 inch (or LOENGLISH). Note that the real unit has to be small enough;
you would not get the expected result by using <i>scale</i>=1 and compensatingly 
scaled-down numbers for <i>rect</i>.
</p>

<H4 class="dtH4">See Also</H4>

<P><A HREF="barcodeDraw1.htm">Draw (1)</A> | <A HREF="barcodeDraw3.htm">Draw (3)</A></P>

<HR>
<font size="-1">&copy; 2002 Bokai Corporation. All rights reserved.</font>
</BODY>
</HTML>

⌨️ 快捷键说明

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