Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21356

Polygon function with no fill

$
0
0
I'm using this code to draw a polygon shape with a border color and a fill color:
VB Code:
  1. Private Sub Polygon2Buffer(backbuffer As Long, border_color As Long, inner_color As Long)
  2.  
  3.  
  4.     Dim mypoly() As POINTAPI
  5.     Dim N As Long
  6.  
  7.     Dim hPen As Long
  8.     Dim nDrawMode As Long
  9.     Dim hOldPen As Long
  10.  
  11.     Dim hBrush As Long
  12.     Dim hOldBrush As Long
  13.  
  14.    'Polygon mypoly and the number of vertices N are
  15.    'calculated here (calculation is ommited)
  16.    '...
  17.    '...
  18.  
  19.     hBrush = CreateSolidBrush(inner_color)
  20.     hOldBrush = SelectObject(backbuffer, hBrush)
  21.  
  22.     hPen = CreatePen(PS_SOLID, 2, border_color)
  23.     hOldPen = SelectObject(backbuffer, hPen)
  24.     nDrawMode = SetROP2(backbuffer, R2_COPYPEN)
  25.  
  26.     Polygon backbuffer, mypoly(0), N
  27.  
  28.     SetROP2 backbuffer, nDrawMode
  29.     SelectObject backbuffer, hOldBrush
  30.     SelectObject backbuffer, hOldPen
  31.    
  32.     DeleteObject hPen
  33.     DeleteObject hBrush
  34.  
  35. End Sub
Now I want to change the code so only the border is drawn because there's something already plotted in the background that should not be overlapped. What kind of brush must I select, or what sort of nDrawMode in the SetROP2 function? (I've tried R2_MASKPEN but I don't like the resulting border)

Viewing all articles
Browse latest Browse all 21356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>