metzge...@gmail.com
unread,Nov 2, 2016, 8:03:52 AM11/2/16You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hello,
how can I merge (Union) 2 path objects to a new path object?
I need the outline of the 2 combined objects as polygon.
My first try:
'local scope
Dim myGraphics As Graphics
Dim myPath As New System.Drawing.Drawing2D.GraphicsPath()
Dim myPath2 As New System.Drawing.Drawing2D.GraphicsPath()
Dim myRegion As Region
Dim myRegion2 As Region
'return the current form as a drawing surface
myGraphics = Me.CreateGraphics 'Graphics.FromHwnd(hwnd:=ActiveForm().Handle)
'create the first path and region
myPath.StartFigure()
myPath.AddRectangle(rect:=New Rectangle(x:=50, y:=50, Width:=50, _
Height:=20))
myRegion = New Region(path:=myPath)
'create the first path and region
myPath2.StartFigure()
Dim myRec As New Rectangle(x:=35, y:=45, Width:=50, Height:=30)
myPath2.AddEllipse(rect:=myRec)
myRegion2 = New Region(path:=myPath2)
'add the paths together
myRegion.Union(region:=myRegion2)
'fill the region
myGraphics.FillRegion(brush:=New SolidBrush(Color.Black), _
region:=myRegion)
but the myRegion.data object is not a polygon :-(