<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Hello!<br>
<br>
I tried to draw polyline.... But on Windows... the end point is not
drawn... the main problem is WinAPI LineTo() function. MSDN says:<br>
<blockquote type="cite">The <strong>LineTo</strong> function draws
a line from the current position up to, but not including, the
specified point.</blockquote>
I think WinAPI Polyline() function uses LineTo() to draw a polyline.
I see a hack in VCL module in WinSalgraphics::drawLine():<br>
<blockquote type="cite">
<pre><span class="c">// we must paint the endpoint</span></pre>
</blockquote>
But there is no such hack for drawPolyLine() function. A possible
solution is same as for drawLine():<br>
<br>
<hr size="2" width="100%"><tt>--- a/vcl/win/source/gdi/salgdi.cxx<br>
+++ b/vcl/win/source/gdi/salgdi.cxx<br>
@@ -1346,10 +1346,45 @@ void WinSalGraphics::drawPolyLine(
sal_uLong nPoints, const SalPoint* pPtAry )<br>
"WinSalGraphics::DrawPolyLine(): POINT !=
SalPoint" );<br>
<br>
POINT* pWinPtAry = (POINT*)pPtAry;<br>
+<br>
+ // we assume there are at least 2 points (Polyline requres at
least 2 point, see MSDN)<br>
+ // we must paint the endpoint for last line<br>
+ BOOL bPaintEnd = TRUE;<br>
+ if ( pWinPtAry[nPoints-2].x == pWinPtAry[nPoints-1].x )<br>
+ {<br>
+ bPaintEnd = FALSE;<br>
+ if ( pWinPtAry[nPoints-2].y <= pWinPtAry[nPoints-1].y
)<br>
+ pWinPtAry[nPoints-1].y++;<br>
+ else<br>
+ pWinPtAry[nPoints-1].y--;<br>
+ }<br>
+ if ( pWinPtAry[nPoints-2].y == pWinPtAry[nPoints-1].y )<br>
+ {<br>
+ bPaintEnd = FALSE;<br>
+ if ( pWinPtAry[nPoints-2].x <= pWinPtAry[nPoints-1].x
)<br>
+ pWinPtAry[nPoints-1].x++;<br>
+ else<br>
+ pWinPtAry[nPoints-1].x--;<br>
+ }<br>
+<br>
// Wegen Windows 95 und der Beschraenkung auf eine maximale
Anzahl<br>
// von Punkten<br>
if ( !Polyline( mhDC, pWinPtAry, (int)nPoints ) &&
(nPoints > MAX_64KSALPOINTS) )<br>
Polyline( mhDC, pWinPtAry, MAX_64KSALPOINTS );<br>
+<br>
+ if ( bPaintEnd && !mbPrinter )<br>
+ {<br>
+ if ( mbXORMode )<br>
+ {<br>
+ HBRUSH hBrush = CreateSolidBrush( mnPenColor );<br>
+ HBRUSH hOldBrush = SelectBrush( mhDC, hBrush );<br>
+ PatBlt( mhDC, (int)(pWinPtAry[nPoints-1].x),
(int)(pWinPtAry[nPoints-1].y), (int)1, (int)1, PATINVERT );<br>
+ SelectBrush( mhDC, hOldBrush );<br>
+ DeleteBrush( hBrush );<br>
+ }<br>
+ else<br>
+ SetPixel( mhDC, (int)(pWinPtAry[nPoints-1].x),
(int)(pWinPtAry[nPoints-1].y), mnPenColor );<br>
+ }<br>
}<br>
<br>
//
-----------------------------------------------------------------------<br>
<br>
<br>
</tt>
<hr size="2" width="100%"><br>
<br>
<br>
<br>
<br>
<br>
<pre class="moz-signature" cols="72">--
Best Regards,
Dmitry</pre>
<br>
<pre class="moz-signature" cols="72">--
Best Regards,
Dmitry</pre>
</body>
</html>