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

📄 barcodedraw3.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 (3)</TITLE></HEAD>
<body topmargin="0">
<font size="-1">&nbsp;Barcode .Net Class Library</font>
<H3>Draw Method (3)</H3>
<p><b>Applies To:</b> <A HREF="barcodeClass.htm">Barcode</A> |
<A HREF="barcodeControlClass.htm">BarcodeControl</A> |
<A HREF="barcodeImageClass.htm">BarcodeImage</A>

<P>Draws a barcode to a Graphics object. This is the most flexible 
of all three versions the Draw method.</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>orientation</i> <b>As</b> <a href="orientationEnum.htm">BarcodeOrientation</a>, _
&nbsp;&nbsp;&nbsp;<b>ByVal</b> <i>font</i> <b>As</b> Font, _
&nbsp;&nbsp;&nbsp;<b>ByVal</b> <i>clrFore</i> <b>As</b> Color, _
&nbsp;&nbsp;&nbsp;<b>ByVal</b> <i>clrBack</i> <b>As</b> Color, _
&nbsp;&nbsp;&nbsp;<b>ByVal</b> <i>flags</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="orientationEnum.htm">BarcodeOrientation</a> <i>orientation</i>, 
&nbsp;&nbsp;&nbsp;Font <i>font</i>, 
&nbsp;&nbsp;&nbsp;Color <i>clrFore</i>, 
&nbsp;&nbsp;&nbsp;Color <i>clrBack</i>, 
&nbsp;&nbsp;&nbsp;<a href="drawFlagsEnum.htm">BarcodeDrawFlags</a> <i>flags</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>orientation</I></DT>
<DD>A <a href="orientationEnum.htm">BarcodeOrientation</a> enumeration specifying the orientation of the barcode; 
this overrides the <a href="barcodeOrientation.htm">Orientation</a> property.
</DD></DL>
<DL><DT><I>font</I></DT>
<DD>Font used to draw the barcode caption(s); this overrides the <a href="barcodeFont.htm">Font</a> property.
</DD></DL>
<DL><DT><I>clrFore</I></DT>
<DD>Color used to draw the barcode bars and caption(s); this overrides the <a href="barcodeForeColor.htm">ForeColor</a> property.
</DD></DL>
<DL><DT><I>clrBack</I></DT>
<DD>Color used to draw the barcode background; this overrides the <a href="barcodeBackColor.htm">BackColor</a> property.
</DD></DL>
<DL><DT><I>flags</I></DT>
<DD>A <a href="drawFlagsEnum.htm">BarcodeDrawFlags</a> enumeration specifying how the barcode is to be drawn.
You can use <a href="barcodeDrawFlagsFromProperties.htm">DrawFlagsFromProperties</a> for the <i>current</i>
or <a href="barcodeDefaultDrawFlags.htm">DefaultDrawFlags</a> for the <i>default</i> value of this parameter. Properties that have corresponding BarcodeDrawFlags members will have their
values overriden by this parameter for the duration of this <b>Draw</b> method call, as shown below,

<table cellspacing="0" border="1">

<TR>
<TH bgcolor="#cccccc">Overriden Property Name</TH>
<TH bgcolor="#cccccc"><a href="drawFlagsEnum.htm">BarcodeDrawFlags</a> Member</TH>
</TR>

<TR>
<TD><tt><a href="barcodeAddOnTextPosition.htm">AddOnTextPosition</a></tt></TD>
<TD><tt>AddOnTextAtTop, AddOnTextAtBottom, HideAddOnText</tt></TD>
</TR>

<TR>
<TD><tt><a href="barcodeHorizontalAlignment.htm">HorizontalAlignment</a></tt></TD>
<TD><tt>Left, Center, Right</tt></TD>
</TR>

<TR>
<TD><tt><a href="barcodePixelAligned.htm">PixelAligned</a></tt></TD>
<TD><tt>NotPixelAligned</tt></TD>
</TR>

<TR>
<TD><tt><a href="barcodeRetainAspectRatio.htm">RetainAspectRatio</a></tt></TD>
<TD><tt>RetainAspectRatio</tt></TD>
</TR>

<TR>
<TD><tt><a href="barcodeShowCode39StartStop.htm">ShowCode39StartStop</a></tt></TD>
<TD><tt>ShowCode39StartStop</tt></TD>
</TR>

<TR>
<TD><tt><a href="barcodeStretchText.htm">StretchText</a></tt></TD>
<TD><tt>NoStretchText</tt></TD>
</TR>

<TR>
<TD><tt><a href="barcodeTextPosition.htm">TextPosition</a></tt></TD>
<TD><tt>MainTextAtTop, MainTextAtBottom, HideMainText</tt></TD>
</TR>

<TR>
<TD><tt><a href="barcodeUniBarHeight.htm">UniBarHeight</a></tt></TD>
<TD><tt>UniBarHeight</tt></TD>
</TR>

<TR>
<TD><tt><a href="barcodeUpcSmallFont.htm">UpcSmallFont</a></tt></TD>
<TD><tt>NoUpcSmallFont</tt></TD>
</TR>

<TR>
<TD><tt><a href="barcodeVerticalAlignment.htm">VerticalAlignment</a></tt></TD>
<TD><tt>Top, Middle, Bottom</tt></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="barcodeDraw2.htm">Draw (2)</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 + -