# GrapeCity.Documents.Drawing.GcGraphics.DrawLine

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Drawing_GcGraphics_DrawLine_" data-uid="GrapeCity.Documents.Drawing.GcGraphics.DrawLine*">DrawLine Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Drawing_GcGraphics_DrawLine_" data-uid="GrapeCity.Documents.Drawing.GcGraphics.DrawLine*"></a>
<h4 id="GrapeCity_Documents_Drawing_GcGraphics_DrawLine_System_Single_System_Single_System_Single_System_Single_System_Drawing_Color_System_Single_GrapeCity_Documents_Drawing_DashStyle_" data-uid="GrapeCity.Documents.Drawing.GcGraphics.DrawLine(System.Single,System.Single,System.Single,System.Single,System.Drawing.Color,System.Single,GrapeCity.Documents.Drawing.DashStyle)">DrawLine(float, float, float, float, Color, float, DashStyle)</h4>
<div class="markdown level1 summary"><p>Draws a line between two points, using a specified line color, width and style.</p>
<p>
If the value of lineStyle parameter is not <a class="xref" href="GrapeCity.Documents.Drawing.DashStyle.html#GrapeCity_Documents_Drawing_DashStyle_Solid">Solid</a>, the line is drawn with a <a class="xref" href="GrapeCity.Documents.Drawing.Pen.html">Pen</a>
having <a class="xref" href="GrapeCity.Documents.Drawing.Pen.LineCap.html#GrapeCity_Documents_Drawing_Pen_LineCap">LineCap</a> set to <a class="xref" href="GrapeCity.Documents.Drawing.PenLineCap.html#GrapeCity_Documents_Drawing_PenLineCap_Square">Square</a> instead of <a class="xref" href="GrapeCity.Documents.Drawing.PenLineCap.html#GrapeCity_Documents_Drawing_PenLineCap_Flat">Flat</a>.
</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void DrawLine(float x1, float y1, float x2, float y2, Color lineColor, float lineWidth, DashStyle lineStyle = DashStyle.Solid)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub DrawLine(x1 As Single, y1 As Single, x2 As Single, y2 As Single, lineColor As Color, lineWidth As Single, Optional lineStyle As DashStyle = DashStyle.Solid)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">x1</span></td>
      <td><p>The X coordinate of the first point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">y1</span></td>
      <td><p>The Y coordinate of the first point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">x2</span></td>
      <td><p>The X coordinate of the second point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">y2</span></td>
      <td><p>The Y coordinate of the second point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.color">Color</a></td>
      <td><span class="parametername">lineColor</span></td>
      <td><p>The line color.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">lineWidth</span></td>
      <td><p>The line width.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Drawing.DashStyle.html">DashStyle</a></td>
      <td><span class="parametername">lineStyle</span></td>
      <td><p>The line style (solid by default).</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Drawing_GcGraphics_DrawLine_" data-uid="GrapeCity.Documents.Drawing.GcGraphics.DrawLine*"></a>
<h4 id="GrapeCity_Documents_Drawing_GcGraphics_DrawLine_System_Single_System_Single_System_Single_System_Single_System_Drawing_Color_System_Single_System_Single___" data-uid="GrapeCity.Documents.Drawing.GcGraphics.DrawLine(System.Single,System.Single,System.Single,System.Single,System.Drawing.Color,System.Single,System.Single[])">DrawLine(float, float, float, float, Color, float, float[])</h4>
<div class="markdown level1 summary"><p>Draws a line between two points, using the specified line color, width and dash pattern.</p>
<p>
If the dashPattern array contains two or more items, the line is drawn with a <a class="xref" href="GrapeCity.Documents.Drawing.Pen.html">Pen</a>
having <a class="xref" href="GrapeCity.Documents.Drawing.Pen.LineCap.html#GrapeCity_Documents_Drawing_Pen_LineCap">LineCap</a> set to <a class="xref" href="GrapeCity.Documents.Drawing.PenLineCap.html#GrapeCity_Documents_Drawing_PenLineCap_Square">Square</a> instead of <a class="xref" href="GrapeCity.Documents.Drawing.PenLineCap.html#GrapeCity_Documents_Drawing_PenLineCap_Flat">Flat</a>.
</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void DrawLine(float x1, float y1, float x2, float y2, Color lineColor, float lineWidth, float[] dashPattern)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub DrawLine(x1 As Single, y1 As Single, x2 As Single, y2 As Single, lineColor As Color, lineWidth As Single, dashPattern As Single())</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">x1</span></td>
      <td><p>The X coordinate of the first point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">y1</span></td>
      <td><p>The Y coordinate of the first point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">x2</span></td>
      <td><p>The X coordinate of the second point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">y2</span></td>
      <td><p>The Y coordinate of the second point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.color">Color</a></td>
      <td><span class="parametername">lineColor</span></td>
      <td><p>The line color.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">lineWidth</span></td>
      <td><p>The line width.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a>[]</td>
      <td><span class="parametername">dashPattern</span></td>
      <td><p>The dash pattern.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Drawing_GcGraphics_DrawLine_" data-uid="GrapeCity.Documents.Drawing.GcGraphics.DrawLine*"></a>
<h4 id="GrapeCity_Documents_Drawing_GcGraphics_DrawLine_System_Drawing_PointF_System_Drawing_PointF_System_Drawing_Color_System_Single_GrapeCity_Documents_Drawing_DashStyle_" data-uid="GrapeCity.Documents.Drawing.GcGraphics.DrawLine(System.Drawing.PointF,System.Drawing.PointF,System.Drawing.Color,System.Single,GrapeCity.Documents.Drawing.DashStyle)">DrawLine(PointF, PointF, Color, float, DashStyle)</h4>
<div class="markdown level1 summary"><p>Draws a line between two points, using a specified line color, width and style.</p>
<p>
If the value of lineStyle parameter is not <a class="xref" href="GrapeCity.Documents.Drawing.DashStyle.html#GrapeCity_Documents_Drawing_DashStyle_Solid">Solid</a>, the line is drawn with a <a class="xref" href="GrapeCity.Documents.Drawing.Pen.html">Pen</a>
having <a class="xref" href="GrapeCity.Documents.Drawing.Pen.LineCap.html#GrapeCity_Documents_Drawing_Pen_LineCap">LineCap</a> set to <a class="xref" href="GrapeCity.Documents.Drawing.PenLineCap.html#GrapeCity_Documents_Drawing_PenLineCap_Square">Square</a> instead of <a class="xref" href="GrapeCity.Documents.Drawing.PenLineCap.html#GrapeCity_Documents_Drawing_PenLineCap_Flat">Flat</a>.
</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void DrawLine(PointF p1, PointF p2, Color lineColor, float lineWidth, DashStyle lineStyle = DashStyle.Solid)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub DrawLine(p1 As PointF, p2 As PointF, lineColor As Color, lineWidth As Single, Optional lineStyle As DashStyle = DashStyle.Solid)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.pointf">PointF</a></td>
      <td><span class="parametername">p1</span></td>
      <td><p>The first point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.pointf">PointF</a></td>
      <td><span class="parametername">p2</span></td>
      <td><p>The second point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.color">Color</a></td>
      <td><span class="parametername">lineColor</span></td>
      <td><p>The line color.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">lineWidth</span></td>
      <td><p>The line width.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Drawing.DashStyle.html">DashStyle</a></td>
      <td><span class="parametername">lineStyle</span></td>
      <td><p>The line style (solid by default).</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Drawing_GcGraphics_DrawLine_" data-uid="GrapeCity.Documents.Drawing.GcGraphics.DrawLine*"></a>
<h4 id="GrapeCity_Documents_Drawing_GcGraphics_DrawLine_System_Drawing_PointF_System_Drawing_PointF_System_Drawing_Color_System_Single_System_Single___" data-uid="GrapeCity.Documents.Drawing.GcGraphics.DrawLine(System.Drawing.PointF,System.Drawing.PointF,System.Drawing.Color,System.Single,System.Single[])">DrawLine(PointF, PointF, Color, float, float[])</h4>
<div class="markdown level1 summary"><p>Draws a line between two points, using the specified line color, width and dash pattern.</p>
<p>
If the dashPattern array contains two or more items, the line is drawn with a <a class="xref" href="GrapeCity.Documents.Drawing.Pen.html">Pen</a>
having <a class="xref" href="GrapeCity.Documents.Drawing.Pen.LineCap.html#GrapeCity_Documents_Drawing_Pen_LineCap">LineCap</a> set to <a class="xref" href="GrapeCity.Documents.Drawing.PenLineCap.html#GrapeCity_Documents_Drawing_PenLineCap_Square">Square</a> instead of <a class="xref" href="GrapeCity.Documents.Drawing.PenLineCap.html#GrapeCity_Documents_Drawing_PenLineCap_Flat">Flat</a>.
</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void DrawLine(PointF p1, PointF p2, Color lineColor, float lineWidth, float[] dashPattern)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub DrawLine(p1 As PointF, p2 As PointF, lineColor As Color, lineWidth As Single, dashPattern As Single())</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.pointf">PointF</a></td>
      <td><span class="parametername">p1</span></td>
      <td><p>The first point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.pointf">PointF</a></td>
      <td><span class="parametername">p2</span></td>
      <td><p>The second point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.color">Color</a></td>
      <td><span class="parametername">lineColor</span></td>
      <td><p>The line color.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">lineWidth</span></td>
      <td><p>The line width.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a>[]</td>
      <td><span class="parametername">dashPattern</span></td>
      <td><p>The dash pattern.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Drawing_GcGraphics_DrawLine_" data-uid="GrapeCity.Documents.Drawing.GcGraphics.DrawLine*"></a>
<h4 id="GrapeCity_Documents_Drawing_GcGraphics_DrawLine_System_Drawing_PointF_System_Drawing_PointF_GrapeCity_Documents_Drawing_Pen_" data-uid="GrapeCity.Documents.Drawing.GcGraphics.DrawLine(System.Drawing.PointF,System.Drawing.PointF,GrapeCity.Documents.Drawing.Pen)">DrawLine(PointF, PointF, Pen)</h4>
<div class="markdown level1 summary"><p>Draws a line between two points, using the specified pen.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void DrawLine(PointF p1, PointF p2, Pen pen)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub DrawLine(p1 As PointF, p2 As PointF, pen As Pen)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.pointf">PointF</a></td>
      <td><span class="parametername">p1</span></td>
      <td><p>The first point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.pointf">PointF</a></td>
      <td><span class="parametername">p2</span></td>
      <td><p>The second point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Drawing.Pen.html">Pen</a></td>
      <td><span class="parametername">pen</span></td>
      <td><p>The pen to use.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Drawing_GcGraphics_DrawLine_" data-uid="GrapeCity.Documents.Drawing.GcGraphics.DrawLine*"></a>
<h4 id="GrapeCity_Documents_Drawing_GcGraphics_DrawLine_System_Single_System_Single_System_Single_System_Single_GrapeCity_Documents_Drawing_Pen_" data-uid="GrapeCity.Documents.Drawing.GcGraphics.DrawLine(System.Single,System.Single,System.Single,System.Single,GrapeCity.Documents.Drawing.Pen)">DrawLine(float, float, float, float, Pen)</h4>
<div class="markdown level1 summary"><p>Draws a line between two points, using the specified pen.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void DrawLine(float x1, float y1, float x2, float y2, Pen pen)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub DrawLine(x1 As Single, y1 As Single, x2 As Single, y2 As Single, pen As Pen)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">x1</span></td>
      <td><p>The X coordinate of the first point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">y1</span></td>
      <td><p>The Y coordinate of the first point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">x2</span></td>
      <td><p>The X coordinate of the second point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">y2</span></td>
      <td><p>The Y coordinate of the second point.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Drawing.Pen.html">Pen</a></td>
      <td><span class="parametername">pen</span></td>
      <td><p>The pen to use.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
