Index: trunk/ab5.0/ablib/src/Classes/System/Drawing/Graphics.ab
===================================================================
--- trunk/ab5.0/ablib/src/Classes/System/Drawing/Graphics.ab	(revision 635)
+++ trunk/ab5.0/ablib/src/Classes/System/Drawing/Graphics.ab	(revision 698)
@@ -4,13 +4,54 @@
 Namespace Drawing
 
-Class Brush : End Class
-Class Pen : End Class
-Class StringFormat : End Class
-Class Image : End Class
-Class ImageAttributes : End Class
-Class Metafile : End Class
-Class Region : End Class
-Class GraphicsPath : End Class
-Class CachedBitmap : End Class
+Class Brush
+Public
+	nativeBrush As *GpBrush
+End Class
+Class StringFormat
+Public
+	nativeFormat As *GpStringFormat	
+End Class
+Class Image
+Public
+	nativeImage As *GpImage
+End Class
+Class ImageAttributes
+Public
+	nativeImage As *GpImageAttributes
+End Class
+Class Metafile
+Inherits Image
+End Class
+Class Region
+Public
+	nativeRegion As *GpRegion
+End Class
+Class GraphicsPath
+Public
+	nativePath As *GpPath
+End Class
+Class CachedBitmap
+Public
+	nativeCachedBitmap As *GpCachedBitmap
+End Class
+
+Delegate Function EnumerateMetafileProc(recordType As EmfPlusRecordType, flags As DWord, dataSize As DWord, data As *Byte, callbackData As VoidPtr) As Boolean
+
+Namespace Detail
+
+TypeDef NativeEnumerateMetafileProc = *Function(recordType As EmfPlusRecordType, flags As DWord, dataSize As DWord, data As *Byte, callbackData As VoidPtr) As Boolean
+
+Type EnumerateMetafileProcData
+	Proc As EnumerateMetafileProc
+	Data As VoidPtr
+End Type
+
+Function NativeEnumerateMetafileProcEntry(recordType As EmfPlusRecordType, flags As DWord, dataSize As DWord, data As *Byte, callbackData As VoidPtr) As Boolean
+	Dim procData = callbackData As *EnumerateMetafileProcData
+	Dim proc = procData->Proc
+	NativeEnumerateMetafileProcEntry = proc(recordType, flags, dataSize, data, procData->Data)
+End Function
+
+End Namespace
 
 Class Graphics
@@ -20,147 +61,142 @@
 	'=========================================================================
 	Const Function Clip() As Region
-		Dim r As Region
-		GetClip(r)
-		Return r
-	End Function
-
-	Sub Clip(region As /*Const*/ Region)
-		SetClip(region, CombineMode.Replace)
+		Clip = New Region
+		SetStatus(GdipGetClip(nativeGraphics, Clip.nativeRegion))
+	End Function
+
+	Sub Clip(region As Region)
+		Imports System.Drawing.Drawing2D
+		SetStatus(GdipSetClipRegion(nativeGraphics, region.nativeRegion, CombineMode.Replace))
 	End Sub
 
 	Const Function ClipBounds() As RectangleF
-		Dim rc As RectangleF
-		GetClipBounds(rc)
-		Return rc
-	End Function
-
-	Sub ClipBounds(rc As RectangleF)
-		SetClipBounds(rc)
-	End Sub
-
-	Function CompositingMode() As CompositingMode
-		Return GetCompositingMode()
-	End Function
-
-	Sub CompositingMode(mode As CompositingMode)
-		SetCompositingMode(mode)
-	End Sub
-
-	Function CompositingQuality() As CompositingQuality
-		Return GetCompositingQuality()
-	End Function
-
-	Sub CompositingQuality(cq As CompositingQuality)
-		SetCompositingQuality(cq)
-	End Sub
-
+		SetStatus(GdipGetClipBounds(nativeGraphics, ClipBounds))
+	End Function
+
+	Const Function ClipBoundsI() As Rectangle
+		SetStatus(GdipGetClipBoundsI(nativeGraphics, ClipBoundsI))
+	End Function
+/*
+	Const Function CompositingMode() As Drawing2D.CompositingMode
+		SetStatus(GdipGetCompositingMode(nativeGraphics, CompositingMode))
+	End Function
+
+	Sub CompositingMode(mode As Drawing2D.CompositingMode)
+		SetStatus(GdipSetCompositingMode(nativeGraphics, mode))
+	End Sub
+
+	Function CompositingQuality() As Drawing2D.CompositingQuality
+		SetStatus(GdipGetCompositingQuality(nativeGraphics, CompositingQuality))
+	End Function
+
+	Sub CompositingQuality(cq As Drawing2D.CompositingQuality)
+		Return SetStatus(GdipSetCompositingQuality(nativeGraphics, cq))
+	End Sub
+*/
 	Const Function DpiX() As Single
-		Dim dpi As Single
-		SetStatus(GdipGetDpiX(nativeGraphics, dpi))
-		Return dpi
+		SetStatus(GdipGetDpiX(nativeGraphics, DpiX))
 	End Function
 
 	Const Function DpiY() As Single
-		Dim dpi As Single
-		SetStatus(GdipGetDpiY(nativeGraphics, dpi))
-		Return dpi
-	End Function
-
-	Const Function InterpolationMode() As InterpolationMode
-		Return GetInterpolationMode()
-	End Function
-
-	Sub InterpolationMode(im As InterpolationMode)
-		SetInterpolationMode(im)
-	End Sub
-
-	Const Function IsClipEmpty() As BOOL
+		SetStatus(GdipGetDpiY(nativeGraphics, DpiY))
+	End Function
+/*
+	Const Function InterpolationMode() As Drawing2D.InterpolationMode
+		SetStatus(GdipGetInterpolationMode(nativeGraphics, InterpolationMode))
+	End Function
+
+	Sub InterpolationMode(im As Drawing2D.InterpolationMode)
+		InterpolationMode = SetStatus(GdipSetInterpolationMode(nativeGraphics, im))
+	End Sub
+*/
+	Const Function IsClipEmpty() As Boolean
 		Dim b = FALSE As BOOL
 		SetStatus(GdipIsClipEmpty(nativeGraphics, b))
-		Return b
-	End Function
-
-	Const Function IsVisibleClipEmpty() As BOOL
+		IsClipEmpty = b As Boolean
+	End Function
+
+	Const Function IsVisibleClipEmpty() As Boolean
 		Dim b = FALSE As BOOL
 		SetStatus(GdipIsVisibleClipEmpty(nativeGraphics, b))
-		Return b
-	End Function
-
-	Function PageScale(scale As Single) As Status
-		Return SetStatus(GdipSetPageScale(nativeGraphics, scale))
-	End Function
+		IsVisibleClipEmpty = b As Boolean
+	End Function
+
+	Sub PageScale(scale As Single)
+		SetStatus(GdipSetPageScale(nativeGraphics, scale))
+	End Sub
 
 	Const Function PageScale() As Single
-		Dim scale As Single
-		SetStatus(GdipGetPageScale(nativeGraphics, scale))
-		Return scale
-	End Function
-
+		SetStatus(GdipGetPageScale(nativeGraphics, PageScale))
+	End Function
+/*
 	Const Function PageUnit() As GraphicsUnit
-		Dim unit As GraphicsUnit
-		SetStatus(GdipGetPageUnit(nativeGraphics, unit))
-		Return unit
-	End Function
-
-	Function PageUnit(unit As GraphicsUnit) As Status
-		Return SetStatus(GdipSetPageUnit(nativeGraphics, unit))
-	End Function
-
-	Function PixelOffsetMode() As PixelOffsetMode
-		Return GetPixelOffsetMode()
-	End Function
-
-	Sub PixelOffsetMode(mode  As PixelOffsetMode)
-		SetPixelOffsetMode(mode)
+		SetStatus(GdipGetPageUnit(nativeGraphics, PageUnit))
+	End Function
+*/
+	Sub PageUnit(unit As GraphicsUnit)
+		SetStatus(GdipSetPageUnit(nativeGraphics, unit))
+	End Sub
+/*
+	Function PixelOffsetMode() As Drawing2D.PixelOffsetMode
+		PixelOffsetMode = System.Drawing.Drawing2D.PixelOffsetMode.Invalid
+		SetStatus(GdipGetPixelOffsetMode(nativeGraphics, PixelOffsetMode))
+	End Function
+*/
+	Sub PixelOffsetMode(mode As Drawing2D.PixelOffsetMode)
+		SetStatus(GdipSetPixelOffsetMode(nativeGraphics, mode))
 	End Sub
 
 	Function RenderingOrigin() As Point
-		Dim pt As Point
-		GetRenderingOrigin(pt.X, pt.Y)
-		Return pt
+		With RenderingOrigin
+			.X = 0
+			.Y = 0
+			SetStatus(GdipGetRenderingOrigin(nativeGraphics, .X, .Y))
+		End With
 	End Function
 
 	Sub RenderingOrigin(pt As Point)
-		SetRenderingOrigin(pt.X, pt.Y)
-	End Sub
-
-	Function SmoothingMode() As SmoothingMode
-		Return GetSmoothingMode()
-	End Function
-
-	Sub SmoothingMode(mode As SmoothingMode)
-		SetSmoothingMode(mode)
+		SetStatus(GdipSetRenderingOrigin(nativeGraphics, pt.X, pt.Y))
+	End Sub
+/*
+	Function SmoothingMode() As Drawing2D.SmoothingMode
+		SetStatus(GdipGetSmoothingMode(nativeGraphics, SmoothingMode))
+	End Function
+*/
+	Sub SmoothingMode(mode As Drawing2D.SmoothingMode)
+		SetStatus(GdipSetSmoothingMode(nativeGraphics, mode))
 	End Sub
 
 	Function TextContrast() As DWord
-		Return GetTextContrast()
+		SetStatus(GdipGetTextContrast(nativeGraphics, TextContrast))
 	End Function
 
 	Sub TextContrast(contrast As DWord)
-		SetTextContrast(contrast)
-	End Sub
-
-	Function TextRenderingHint() As TextRenderingHint
-		Return GetTextRenderingHint()
-	End Function
-
+		SetStatus(GdipSetTextContrast(nativeGraphics, contrast))
+	End Sub
+/*
+	Function TextRenderingHint() As Text.TextRenderingHint
+		SetStatus(GdipGetTextRenderingHint(nativeGraphics, ByVal VarPtr(TextRenderingHint)))
+	End Function
+*/
 	Sub TextRenderingHint(mode As TextRenderingHint)
-		SetTextRenderingHint(mode)
-	End Sub
-
-	Function Transform() As Matrix
-		Dim matrix As Matrix
-		GetTransform(matrix)
-		Return matrix
-	End Function
-
-	Sub Transform(matrix As Matrix)
-		SetTransform(matirx)
+		SetStatus(GdipSetTextRenderingHint(nativeGraphics, mode))
+	End Sub
+
+	Function Transform() As Drawing2D.Matrix
+		Dim native As *GpMatrix
+		SetStatus(GdipGetWorldTransform(nativeGraphics, native))
+		Transform = New Drawing2D.Matrix(native)
+	End Function
+
+	Sub Transform(matrix As Drawing2D.Matrix)
+		SetStatus(GdipSetWorldTransform(nativeGraphics, matrix.nativeMatrix))
 	End Sub
 
 	Function VisibleClipBounds() As RectangleF
-		Dim rc As RectangleF
-		GetVisibleClipBounds(rc)
-		Return rc
+		SetStatus(GdipGetVisibleClipBounds(nativeGraphics, VisibleClipBounds))
+	End Function
+
+	Function VisibleClipBoundsI() As Rectangle
+		SetStatus(GdipGetVisibleClipBoundsI(nativeGraphics, VisibleClipBoundsI))
 	End Function
 
@@ -169,81 +205,60 @@
 	'=========================================================================
 	Static Function FromHDC(hdc As HDC) As Graphics
-		Return New Graphics(hdc)
+		Dim graphics = 0 As *GpGraphics
+		SetStatus(GdipCreateFromHDC(hdc, graphics))
+		Return New Graphics(graphics)
 	End Function
 
 	Static Function FromHDC(hdc As HDC, hdevice As HANDLE) As Graphics
-		Return New Graphics(hdc, hdevice)
-	End Function
-
-	Static Function FromHWND(hwnd As HWND) As Graphics
-		Return New Graphics(hwnd, FALSE)
-	End Function
-
-	Static Function FromHWND(hwnd As DWord, icm As BOOL) As Graphics
-		Return New Graphics(hwnd, icm)
+		Dim graphics = 0 As *GpGraphics
+		SetStatus(GdipCreateFromHDC2(hdc, hdevice, graphics))
+		Return New Graphics(graphics)
+	End Function
+
+	Static Function FromHwnd(hwnd As HWND) As Graphics
+		Dim graphics = 0 As *GpGraphics
+		SetStatus(GdipCreateFromHWND(hwnd, graphics))
+		Return New Graphics(graphics)
+	End Function
+
+	Static Function FromHwnd(hwnd As HWND, icm As Boolean) As Graphics
+		Dim graphics = 0 As *GpGraphics
+		If icm Then
+			SetStatus(GdipCreateFromHWNDICM(hwnd, graphics))
+		Else
+			SetStatus(GdipCreateFromHWND(hwnd, graphics))
+		End If
+		Return New Graphics(graphics)
 	End Function
 
 	Static Function FromImage(image As Image) As Graphics
-		Return New Graphics(image)
-	End Function
-
-	Sub Graphics(hdc As HDC)
-		Dim graphics = 0 As GpGraphics
-		lastResult = GdipCreateFromHDC(hdc, graphics)
-		SetNativeGraphics(graphics)
-	End Sub
-
-	Sub Graphics(hdc As HDC, hdevice As HANDLE)
+		If ActiveBasic.IsNothing(image) Then
+			Throw New ArgumentNullException("image")
+		End If
 		Dim graphics = 0 As *GpGraphics
-		lastResult = GdipCreateFromHDC2(hdc, hdevice, graphics)
-		SetNativeGraphics(graphics)
-	End Sub
-
-	Sub Graphics(hwnd As HWND)
-		Dim graphics = 0 As *GpGraphics
-		lastResult = GdipCreateFromHWND(hwnd, graphics)
-		SetNativeGraphics(graphics)
-	End Sub
-
-	Sub Graphics(hwnd As HWND, icm As BOOL)
-		Dim graphics = 0 As *GpGraphics
-		If icm <> FALSE Then
-			lastResult = GdipCreateFromHWNDICM(hwnd, graphics)
-		Else
-			lastResult = GdipCreateFromHWND(hwnd, graphics)
-		End If
-		SetNativeGraphics(graphics)
-	End Sub
-
-	Sub Graphics(image As Image)
-		Dim graphics = 0 As *GpGraphics
-		If (image != 0)
-			lastResult = GdipGetImageGraphicsContext(image->NativeImage, graphics)
-		End If
-		SetNativeGraphics(graphics)
+		SetStatus(GdipGetImageGraphicsContext(image.nativeImage, graphics))
+		Return New Graphics(graphics)
+	End Function
+
+	Sub Dispose()
+		GdipDeleteGraphics(nativeGraphics)
+		nativeGraphics = 0
 	End Sub
 
 	Sub ~Graphics()
-		GdipDeleteGraphics(nativeGraphics)
+		Dispose()
 	End Sub
 
 	Sub Flush()
-		GdipFlush(nativeGraphics, FlushIntention.Flush)
-	End Sub
-
-	Sub Flush(intention As FlushIntention)
+		GdipFlush(nativeGraphics, System.Drawing.Drawing2D.FlushIntention.Flush)
+	End Sub
+
+	Sub Flush(intention As Drawing2D.FlushIntention)
 		GdipFlush(nativeGraphics, intention)
 	End Sub
 
-	'------------------------------------------------------------------------
-	' GDI Interop methods
-	'------------------------------------------------------------------------
-
-	' Locks the graphics until ReleaseDC is called
-
 	Function GetHDC() As HDC
-		Dim hdc = 0 As HDC
-		SetStatus(GdipGetDC(nativeGraphics, hdc))
-		Return hdc
+		GetHDC = 0
+		SetStatus(GdipGetDC(nativeGraphics, GetHDC))
 	End Function
 
@@ -252,855 +267,553 @@
 	End Sub
 
-	'------------------------------------------------------------------------
-	' Rendering modes
-	'------------------------------------------------------------------------
-
-	Function SetRenderingOrigin(x As Long, y As Long) As Status
-		Return SetStatus(GdipSetRenderingOrigin(nativeGraphics, x, y))
-	End Function
-
-	Const Function GetRenderingOrigin(x As Long, y As Long) As Status
-		Return SetStatus(GdipGetRenderingOrigin(nativeGraphics, x, y))
-	End Function
-
-	Function SetCompositingMode(compositingMode As CompositingMode) As Status
-		Return SetStatus(GdipSetCompositingMode(nativeGraphics, compositingMode))
-	End Function
-
-	Const Function GetCompositingMode() As CompositingMode
-		Dim mode As CompositingMode
-		SetStatus(GdipGetCompositingMode(nativeGraphics, mode))
-		Return mode
-	End Function
-
-	Function SetCompositingQuality(compositingQuality As CompositingQuality)
-		Return SetStatus(GdipSetCompositingQuality(nativeGraphics, compositingQuality))
-	End Function
-
-	Const Function GetCompositingQuality() As CompositingQuality
-		Dim quality As CompositingQuality
-		SetStatus(GdipGetCompositingQuality(nativeGraphics, quality))
-		Return quality
-	End Function
-
-	Function SetTextRenderingHint(newMode As TextRenderingHint) As Status
-		Return SetStatus(GdipSetTextRenderingHint(nativeGraphics, newMode))
-	End Function
-
-	Const Function GetTextRenderingHint() As TextRenderingHint
-		Dim hint As TextRenderingHint
-		SetStatus(GdipGetTextRenderingHint(nativeGraphics, hint))
-		Return hint
-	End Function
-
-	Function SetTextContrast(contrast As DWord) As Status
-		Return SetStatus(GdipSetTextContrast(nativeGraphics, contrast))
-	End Function
-
-	Const Function GetTextContrast() As DWord
-		Dim contrast As DWord
-		SetStatus(GdipGetTextContrast(nativeGraphics, contrast))
-		Return contrast
-	End Function
-
-	Const Function GetInterpolationMode() As InterpolationMode
-		Dim mode = InterpolationMode.Invalid As InterpolationMode
-		SetStatus(GdipGetInterpolationMode(nativeGraphics, mode))
-		Return mode
-	End Function
-
-	Function SetInterpolationMode(interpolationMode As InterpolationMode) As Status
-		Return SetStatus(GdipSetInterpolationMode(nativeGraphics, interpolationMode))
-	End Function
-
-	Const Function GetSmoothingMode() As SmoothingMode
-		Dim smoothingMode = SmoothingMode.Invalid As SmoothingMode
-		SetStatus(GdipGetSmoothingMode(nativeGraphics, smoothingMode))
-		Return smoothingMode
-	End Function
-
-	Function SetSmoothingMode(smoothingMode As SmoothingMode) As Status
-		Return SetStatus(GdipSetSmoothingMode(nativeGraphics, smoothingMode))
-	End Function
-
-	Const Function GetPixelOffsetMode() As PixelOffsetMode
-		Dim pixelOffsetMode = PixelOffsetMode.Invalid As PixelOffsetMode
-		SetStatus(GdipGetPixelOffsetMode(nativeGraphics, pixelOffsetMode))
-		Return pixelOffsetMode
-	End Function
-
-	Function SetPixelOffsetMode(pixelOffsetMode As PixelOffsetMode) As Status
-		Return SetStatus(GdipSetPixelOffsetMode(nativeGraphics, pixelOffsetMode))
-	End Function
-
-	'------------------------------------------------------------------------
-	' Manipulate current world transform
-	'------------------------------------------------------------------------
-
-	Function SetTransform(matrix As /*Const*/ *Matrix) As Status
-		Return SetStatus(GdipSetWorldTransform(nativeGraphics, matrix->nativeMatrix))
-	End Function
-
-	Function ResetTransform() As Status
-		Return SetStatus(GdipResetWorldTransform(nativeGraphics))
-	End Function
-
-	Function MultiplyTransform(matrix As /*Const*/ Matrix) As Status
-		Return SetStatus(GdipMultiplyWorldTransform(nativeGraphics, matrix->nativeMatrix, MatrixOrder.Prepend))
-	End Function
-
-	Function MultiplyTransform(matrix As /*Const*/ Matrix, order As MatrixOrder) As Status
-		Return SetStatus(GdipMultiplyWorldTransform(nativeGraphics, matrix->nativeMatrix, order))
-	End Function
-
-	Function TranslateTransform(dx As Single, dy As Single) As Status
-		Return SetStatus(GdipTranslateWorldTransform(nativeGraphics, dx, dy, MatrixOrder.Prepend))
-	End Function
-
-	Function TranslateTransform(dx As Single, dy As Single, order As MatrixOrder) As Status
-		Return SetStatus(GdipTranslateWorldTransform(nativeGraphics, dx, dy, order))
-	End Function
-
-	Function ScaleTransform(sx As Single, sy As Single) As Status
-		Return SetStatus(GdipScaleWorldTransform(nativeGraphics, sx, sy, MatrixOrder.Prepend))
-	End Function
-
-	Function ScaleTransform(sx As Single, sy As Single, order As MatrixOrder) As Status
-		Return SetStatus(GdipScaleWorldTransform(nativeGraphics, sx, sy, order))
-	End Function
-
-	Function RotateTransform(angle As Single) As Status
-		Return SetStatus(GdipRotateWorldTransform(nativeGraphics, angle, MatrixOrder.Prepend))
-	End Function
-
-	Function RotateTransform(angle As Single, order As MatrixOrder) As Status
-		Return SetStatus(GdipRotateWorldTransform(nativeGraphics, angle, order))
-	End Function
-
-	Const Function GetTransform(matrix As Matrix) As Status
-		Return SetStatus(GdipGetWorldTransform(nativeGraphics, matrix->nativeMatrix))
-	End Function
-
-	Const Function TransformPoints(destSpace As CoordinateSpace, srcSpace As CoordinateSpace, pts As PointF, count As Long) As Status
-		Return SetStatus(GdipTransformPoints(nativeGraphics, destSpace, srcSpace, pts, count))
-	End Function
-
-	Const Function TransformPoints(destSpace As CoordinateSpace, srcSpace As CoordinateSpace, pts As Point, count As Long) As Status
-		Return SetStatus(GdipTransformPointsI(nativeGraphics, destSpace, srcSpace, pts, count))
-	End Function
-
-	'------------------------------------------------------------------------
-	' GetNearestColor (for <= 8bpp surfaces).	Note: Alpha is ignored.
-	'------------------------------------------------------------------------
-
-	Const Function GetNearestColor(color As Color) As Status
-		Dim argb = color->Value
-		Dim status = SetStatus(GdipGetNearestColor(nativeGraphics, argb))
-		color->Value = argb
-		Return status
-	End Function
-
-	Function DrawLine(pen As /*Const*/ Pen, x1 As Single, y1 As Single, x2 As Single, y2 As Single) As Status
-		Return SetStatus(GdipDrawLine(nativeGraphics, pen->nativePen, x1, y1, x2, y2))
-	End Function
-
-	Function DrawLine(pen As /*Const*/ Pen, pt1 As /*Const*/ PointF, pt2 As /*Const*/ PointF) As Status
-		Return DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y)
-	End Function
-
-	Function DrawLines(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long) As Status
-		Return SetStatus(GdipDrawLines(nativeGraphics, pen->nativePen, points, count))
-	End Function
-
-	Function DrawLine(pen As /*Const*/ Pen, x1 As Long, y1 As Long, x2 As Long, y2 As Long) As Status
-		Return SetStatus(GdipDrawLineI(nativeGraphics, pen->nativePen, x1, y1, x2, y2))
-	End Function
-
-	Function DrawLine(pen As /*Const*/ Pen, pt1 As /*Const*/ Point, pt2 As /*Const*/ Point) As Status
-		Return DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y)
-	End Function
-
-	Function DrawLines(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long) As Status
-		Return SetStatus(GdipDrawLinesI(nativeGraphics, pen->nativePen, points, count))
-	End Function
-
-	Function DrawArc(pen As /*Const*/ Pen, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single) As Status
-		Return SetStatus(GdipDrawArc(nativeGraphics, pen->nativePen, x, y, width, height, startAngle, sweepAngle))
-	End Function
-
-	Function DrawArc(pen As /*Const*/ Pen, rect As /*Const*/ RectangleF, startAngle As Single, sweepAngle As Single) As Status
-		Return DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
-	End Function
-
-	Function DrawArc(pen As /*Const*/ Pen, x As Long, y As Long, width As Long, height As Long, startAngle As Single, sweepAngle As Single) As Status
-		Return SetStatus(GdipDrawArcI(nativeGraphics, pen->nativePen, x, y, width, height, startAngle, sweepAngle))
-	End Function
-
-	Function DrawArc(pen As /*Const*/ Pen, rect As /*Const*/ Rectangle, startAngle As Single, sweepAngle As Single) As Status
-		Return DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
-	End Function
-
-	Function DrawBezier(pen As /*Const*/ Pen, x1 As Single, y1 As Single, x2 As Single, y2 As Single, x3 As Single, y3 As Single, x4 As Single, y4 As Single) As Status
-		Return SetStatus(GdipDrawBezier(nativeGraphics, pen->nativePen, x1, y1,x2, y2, x3, y3, x4, y4))
-	End Function
-
-	Function DrawBezier(pen As /*Const*/ Pen, pt1 As /*Const*/ PointF, pt2 As /*Const*/ PointF, pt3 As /*Const*/ PointF, pt4 As /*Const*/ PointF) As Status
-		Return DrawBezier(pen, pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y)
-	End Function
-
-	Function DrawBeziers(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long) As Status
-		Return SetStatus(GdipDrawBeziers(nativeGraphics, pen->nativePen, points, count))
-	End Function
-
-	Function DrawBezier(pen As /*Const*/ Pen, x1 As Long, y1 As Long, x2 As Long, y2 As Long, x3 As Long, y3 As Long, x4 As Long, y4 As Long) As Status
-		Return SetStatus(GdipDrawBezierI(nativeGraphics, pen->nativePen, x1, y1, x2, y2, x3, y3, x4, y4))
-	End Function
-
-	Function DrawBezier(pen As /*Const*/ Pen, pt1 As /*Const*/ Point, pt2 As /*Const*/ Point, pt3 As /*Const*/ Point, pt4 As /*Const*/ Point) As Status
-		Return DrawBezier(pen pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y)
-	End Function
-
-	Function DrawBeziers(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long) As Status
-		Return SetStatus(GdipDrawBeziersI(nativeGraphics, pen->nativePen, points, count))
-	End Function
-
-	Function DrawRectangle(pen As /*Const*/ Pen, rect As /*Const*/ RectangleF) As Status
-		Return DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height)
-	End Function
-
-	Function DrawRectangle(pen As /*Const*/ Pen, x As Single, y As Single, width As Single, height As Single) As Status
-		Return SetStatus(GdipDrawRectangle(nativeGraphics, pen->nativePen, x, y, width, height))
-	End Function
-
-	Function DrawRectangles(pen As /*Const*/ Pen, rects As /*Const*/ *RectangleF, count As Long) As Status
-		Return SetStatus(GdipDrawRectangles(nativeGraphics, pen->nativePen, rects, count))
-	End Function
-
-	Function DrawRectangle(pen As /*Const*/ Pen, rect As /*Const*/ Rectangle) As Status
-		Return DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height)
-	End Function
-
-	Function DrawRectangle(pen As /*Const*/ Pen, x As Long, y As Long, width As Long, height As Long) As Status
-		Return SetStatus(GdipDrawRectangleI(nativeGraphics, pen->nativePen, x, y, width, height))
-	End Function
-
-	Function DrawRectangles(pen As /*Const*/ Pen, rects As /*Const*/ *Rectangle,  count As Long) As Status
-		Return SetStatus(GdipDrawRectanglesI(nativeGraphics, pen->nativePen, rects, count))
-	End Function
-
-	Function DrawEllipse(pen As /*Const*/ Pen, rect As /*Const*/ RectangleF) As Status
-		Return DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height)
-	End Function
-
-	Function DrawEllipse(pen As /*Const*/ Pen, x As Single, y As Single, width As Single, height As Single) As Status
-		Return SetStatus(GdipDrawEllipse(nativeGraphics, pen->nativePen, x, y, width, height))
-	End Function
-
-	Function DrawEllipse(pen As /*Const*/ Pen, rect As /*Const*/ Rectangle) As Status
-		Return DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height)
-	End Function
-
-	Function DrawEllipse(pen As /*Const*/ Pen, x As Long, y As Long, width As Long, height As Long) As Status
-		Return SetStatus(GdipDrawEllipseI(nativeGraphics, pen->nativePen, x, y, width, height))
-	End Function
-
-	Function DrawPie(pen As /*Const*/ Pen, rect As /*Const*/ RectangleF, startAngle As Single, sweepAngle As Single) As Status
-		Return DrawPie(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
-	End Function
-
-	Function DrawPie(pen As /*Const*/ Pen, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single) As Status
-		Return SetStatus(GdipDrawPie(nativeGraphics, pen->nativePen, x, y, width, height, startAngle, sweepAngle))
-	End Function
-
-	Function DrawPie(pen As /*Const*/ Pen, rect As /*Const*/ Rectangle, startAngle As Single, sweepAngle As Single) As Status
-		Return DrawPie(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
-	End Function
-
-	Function DrawPie(pen As /*Const*/ Pen, x As Long, y As Long, width As Long, height As Long, startAngle As Single, sweepAngle As Single) As Status
-		Return SetStatus(GdipDrawPieI(nativeGraphics, pen->nativePen, x, y, width, height, startAngle, sweepAngle))
-	End Function
-
-	Function DrawPolygon(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long) As Status
-		Return SetStatus(GdipDrawPolygon(nativeGraphics, pen->nativePen, points, count))
-	End Function
-
-	Function DrawPolygon(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long) As Status
-		Return SetStatus(GdipDrawPolygonI(nativeGraphics, pen->nativePen, points, count))
-	End Function
-
-	Function DrawPath(pen As /*Const*/ Pen, path As /*Const*/ GraphicsPath) As Status
-		Return SetStatus(GdipDrawPath(nativeGraphics, pen->nativePen, path->nativePath))
-'		Return SetStatus(GdipDrawPath(nativeGraphics, pen ? pen->nativePen : NULL, path ? path->nativePath : NULL))
-	End Function
-
-	Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long) As Status
-		Return SetStatus(GdipDrawCurve(nativeGraphics, pen->nativePen, points, count))
-	End Function
-
-	Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long, tension As Single) As Status
-		Return SetStatus(GdipDrawCurve2(nativeGraphics, pen->nativePen, points,count, tension))
-	End Function
-
-	Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long, offset As Long, numberOfSegments As Long) As Status
-		Return SetStatus(GdipDrawCurve3(nativeGraphics, pen->nativePen, points, count, offset,numberOfSegments, 0.5))
-	End Function
-
-	Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long, offset As Long, numberOfSegments As Long, tension As Single) As Status
-		Return SetStatus(GdipDrawCurve3(nativeGraphics, pen->nativePen, points, count, offset,numberOfSegments, tension))
-	End Function
-
-	Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long) As Status
-		Return SetStatus(GdipDrawCurveI(nativeGraphics, pen->nativePen, points, count))
-	End Function
-
-	Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long, tension As Single) As Status
-		Return SetStatus(GdipDrawCurve2I(nativeGraphics, pen->nativePen, points, count, tension))
-	End Function
-
-	Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long, offset As Long, numberOfSegments As Long) As Status
-		Return SetStatus(GdipDrawCurve3I(nativeGraphics, pen->nativePen, points, count, offset, numberOfSegments, 0.5))
-	End Function
-
-	Function DrawCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long, offset As Long, numberOfSegments As Long, tension As Single) As Status
-		Return SetStatus(GdipDrawCurve3I(nativeGraphics, pen->nativePen, points, count, offset, numberOfSegments, tension))
-	End Function
-
-	Function DrawClosedCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long) As Status
-		Return SetStatus(GdipDrawClosedCurve(nativeGraphics, pen->nativePen, points, count))
-	End Function
-
-	Function DrawClosedCurve(pen As /*Const*/ Pen, points As /*Const*/ *PointF, count As Long, tension As Single) As Status
-		Return SetStatus(GdipDrawClosedCurve2(nativeGraphics, pen->nativePen, points, count, tension))
-	End Function
-
-	Function DrawClosedCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long) As Status
-		Return SetStatus(GdipDrawClosedCurveI(nativeGraphics, pen->nativePen, points, count))
-	End Function
-
-	Function DrawClosedCurve(pen As /*Const*/ Pen, points As /*Const*/ *Point, count As Long, tension As Single) As Status
-		Return SetStatus(GdipDrawClosedCurve2I(nativeGraphics, pen->nativePen, points, count, tension))
-	End Function
-
-	Function Clear(color As /*Const*/ Color) As Status
-		Return SetStatus(GdipGraphicsClear(nativeGraphics, color.Value))
-	End Function
-
-	Function FillRectangle(brush As /*Const*/ Brush, rect As /*Const*/ RectangleF) As Status
-		Return FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height)
-	End Function
-
-	Function FillRectangle(brush As /*Const*/ Brush, x As Single, y As Single, width As Single, height As Single) As Status
-		Return SetStatus(GdipFillRectangle(nativeGraphics, brush->nativeBrush, x, y, width, height))
-	End Function
-
-	Function FillRectangles(brush As /*Const*/ Brush, rects As /*Const*/ *RectangleF, count As Long) As Status
-		Return SetStatus(GdipFillRectangles(nativeGraphics,brush->nativeBrush,rects, count))
-	End Function
-
-	Function FillRectangle(brush As /*Const*/ Brush, rect As /*Const*/ Rectangle) As Status
-		Return FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height)
-	End Function
-
-	Function FillRectangle(brush As /*Const*/ Brush, x As Long, y As Long, width As Long, height As Long) As Status
-		Return SetStatus(GdipFillRectangleI(nativeGraphics, brush->nativeBrush, x, y, width, height))
-	End Function
-
-	Function FillRectangles(brush As /*Const*/ Brush, rects As /*Const*/ *Rectangle, count As Long) As Status
-		Return SetStatus(GdipFillRectanglesI(nativeGraphics, brush->nativeBrush, rects, count))
-	End Function
-
-	Function FillPolygon(brush As /*Const*/ Brush, points As /*Const*/ *PointF, count As Long) As Status
-		Return FillPolygon(brush, points, count, FillModeAlternate)
-	End Function
-
-	Function FillPolygon(brush As /*Const*/ Brush, points As /*Const*/ *PointF, count As Long, fillMode As FillMode) As Status
-		Return SetStatus(GdipFillPolygon(nativeGraphics, brush->nativeBrush, points, count, fillMode))
-	End Function
-
-	Function FillPolygon(brush As /*Const*/ Brush, points As /*Const*/ *Point, count As Long) As Status
-		Return FillPolygon(brush, points, count, FillModeAlternate)
-	End Function
-
-	Function FillPolygon(brush As /*Const*/ Brush, points As /*Const*/ *Point, count As Long, fillMode As FillMode) As Status
-		Return SetStatus(GdipFillPolygonI(nativeGraphics, brush->nativeBrush, points, count, fillMode))
-	End Function
-
-	Function FillEllipse(brush As /*Const*/ Brush, rect As /*Const*/ RectangleF) As Status
-		Return FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height)
-	End Function
-
-	Function FillEllipse(brush As /*Const*/ Brush, x As Single, y As Single, width As Single, height As Single) As Status
-		Return SetStatus(GdipFillEllipse(nativeGraphics, brush->nativeBrush, x, y, width, height))
-	End Function
-
-	Function FillEllipse(brush As /*Const*/ Brush, rect As /*Const*/ Rectangle) As Status
-		Return FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height)
-	End Function
-
-	Function FillEllipse(brush As /*Const*/ Brush, x As Long, y As Long, width As Long, height As Long) As Status
-		Return SetStatus(GdipFillEllipseI(nativeGraphics, brush->nativeBrush, x, y, width, height))
-	End Function
-
-	Function FillPie(brush As /*Const*/ Brush, rect As /*Const*/ RectangleF, startAngle As Single, sweepAngle As Single) As Status
-		Return FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
-	End Function
-
-	Function FillPie(brush As /*Const*/ Brush, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single) As Status
-		Return SetStatus(GdipFillPie(nativeGraphics, brush->nativeBrush, x, y, width, height, startAngle, sweepAngle))
-	End Function
-
-	Function FillPie(brush As /*Const*/ Brush, rect As /*Const*/ Rectangle, startAngle As Single, sweepAngle As Single) As Status
-		Return FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
-	End Function
-
-	Function FillPie(brush As /*Const*/ Brush, x As Long, y As Long, width As Long, height As Long, startAngle As Single, sweepAngle As Single) As Status
-		Return SetStatus(GdipFillPieI(nativeGraphics, brush->nativeBrush, x, y, width, height, startAngle, sweepAngle))
-	End Function
-
-	Function FillPath(brush As /*Const*/ Brush, path As /*Const*/ GraphicsPath) As Status
-		Return SetStatus(GdipFillPath(nativeGraphics, brush->nativeBrush, path->nativePath))
-	End Function
-
-	Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *PointF, count As Long) As Status
-		Return SetStatus(GdipFillClosedCurve(nativeGraphics, brush->nativeBrush, points, count))
-	End Function
-
-	Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *PointF, count As Long, fillMode As FillMode) As Status
-		Return SetStatus(GdipFillClosedCurve2(nativeGraphics, brush->nativeBrush, points, count, 0.5, fillMode))
-	End Function
-
-	Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *PointF, count As Long, fillMode As FillMode, tension As Single) As Status
-		Return SetStatus(GdipFillClosedCurve2(nativeGraphics, brush->nativeBrush, points, count, tension, fillMode))
-	End Function
-
-	Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *Point, count As Long) As Status
-		Return SetStatus(GdipFillClosedCurveI(nativeGraphics, brush->nativeBrush, points, count))
-	End Function
-
-	Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *Point, count As Long, fillMode As FillMode) As Status
-		Return SetStatus(GdipFillClosedCurve2I(nativeGraphics, brush->nativeBrush, points, count, 0.5, fillMode))
-	End Function
-
-	Function FillClosedCurve(brush As /*Const*/ Brush, points As /*Const*/ *Point, count As Long, fillMode As FillMode, tension As Single) As Status
-		Return SetStatus(GdipFillClosedCurve2I(nativeGraphics, brush->nativeBrush, points, count, tension, fillMode))
-	End Function
-
-	Function FillRegion(brush As /*Const*/ Brush, region As /*Const*/ Region) As Status
-		Return SetStatus(GdipFillRegion(nativeGraphics, brush->nativeBrush, region->nativeRegion))
-	End Function
-
-	Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF) As Status
-		Dim nativeFont As *GpFont
-		If VarPtr(font) <> 0 Then
-			nativeFont = font.nativeFormat
-		Else
-			nativeFont = 0
+	Sub ResetTransform()
+		SetStatus(GdipResetWorldTransform(nativeGraphics))
+	End Sub
+
+	Sub MultiplyTransform(matrix As Drawing2D.Matrix)
+		SetStatus(GdipMultiplyWorldTransform(nativeGraphics, matrix.nativeMatrix, System.Drawing.Drawing2D.MatrixOrder.Prepend))
+	End Sub
+
+	Sub MultiplyTransform(matrix As Drawing2D.Matrix, order As Drawing2D.MatrixOrder)
+		SetStatus(GdipMultiplyWorldTransform(nativeGraphics, matrix.nativeMatrix, order))
+	End Sub
+
+	Sub TranslateTransform(dx As Single, dy As Single)
+		SetStatus(GdipTranslateWorldTransform(nativeGraphics, dx, dy, System.Drawing.Drawing2D.MatrixOrder.Prepend))
+	End Sub
+
+	Sub TranslateTransform(dx As Single, dy As Single, order As Drawing2D.MatrixOrder)
+		SetStatus(GdipTranslateWorldTransform(nativeGraphics, dx, dy, order))
+	End Sub
+
+	Sub ScaleTransform(sx As Single, sy As Single)
+		SetStatus(GdipScaleWorldTransform(nativeGraphics, sx, sy, System.Drawing.Drawing2D.MatrixOrder.Prepend))
+	End Sub
+
+	Sub ScaleTransform(sx As Single, sy As Single, order As Drawing2D.MatrixOrder)
+		SetStatus(GdipScaleWorldTransform(nativeGraphics, sx, sy, order))
+	End Sub
+
+	Sub RotateTransform(angle As Single)
+		SetStatus(GdipRotateWorldTransform(nativeGraphics, angle, System.Drawing.Drawing2D.MatrixOrder.Prepend))
+	End Sub
+
+	Sub RotateTransform(angle As Single, order As Drawing2D.MatrixOrder)
+		SetStatus(GdipRotateWorldTransform(nativeGraphics, angle, order))
+	End Sub
+
+	Sub TransformPoints(destSpace As Drawing2D.CoordinateSpace, srcSpace As Drawing2D.CoordinateSpace, pts As *PointF, count As Long)
+		SetStatus(GdipTransformPoints(nativeGraphics, destSpace, srcSpace, pts, count))
+	End Sub
+
+	Sub TransformPoints(destSpace As Drawing2D.CoordinateSpace, srcSpace As Drawing2D.CoordinateSpace, pts As *Point, count As Long)
+		SetStatus(GdipTransformPointsI(nativeGraphics, destSpace, srcSpace, pts, count))
+	End Sub
+
+	Const Function GetNearestColor(color As Color) As Color
+		GetNearestColor = color
+		SetStatus(GdipGetNearestColor(nativeGraphics, GetNearestColor))
+	End Function
+
+	Sub DrawLine(pen As Pen, x1 As Single, y1 As Single, x2 As Single, y2 As Single)
+		SetStatus(GdipDrawLine(nativeGraphics, pen.NativePen, x1, y1, x2, y2))
+	End Sub
+
+	Sub DrawLine(pen As Pen, ByRef pt1 As PointF, ByRef pt2 As PointF)
+		DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y)
+	End Sub
+
+	Sub DrawLines(pen As Pen, points As *PointF, count As Long)
+		SetStatus(GdipDrawLines(nativeGraphics, pen.NativePen, points, count))
+	End Sub
+
+	Sub DrawLine(pen As Pen, x1 As Long, y1 As Long, x2 As Long, y2 As Long)
+		SetStatus(GdipDrawLineI(nativeGraphics, pen.NativePen, x1, y1, x2, y2))
+	End Sub
+
+	Sub DrawLine(pen As Pen, ByRef pt1 As Point, ByRef pt2 As Point)
+		DrawLine(pen, pt1.X, pt1.Y, pt2.X, pt2.Y)
+	End Sub
+
+	Sub DrawLines(pen As Pen, points As *Point, count As Long)
+		SetStatus(GdipDrawLinesI(nativeGraphics, pen.NativePen, points, count))
+	End Sub
+
+	Sub DrawArc(pen As Pen, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single)
+		SetStatus(GdipDrawArc(nativeGraphics, pen.NativePen, x, y, width, height, startAngle, sweepAngle))
+	End Sub
+
+	Sub DrawArc(pen As Pen, ByRef rect As RectangleF, startAngle As Single, sweepAngle As Single)
+		DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
+	End Sub
+
+	Sub DrawArc(pen As Pen, x As Long, y As Long, width As Long, height As Long, startAngle As Single, sweepAngle As Single)
+		SetStatus(GdipDrawArcI(nativeGraphics, pen.NativePen, x, y, width, height, startAngle, sweepAngle))
+	End Sub
+
+	Sub DrawArc(pen As Pen, ByRef rect As Rectangle, startAngle As Single, sweepAngle As Single)
+		DrawArc(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
+	End Sub
+
+	Sub DrawBezier(pen As Pen, x1 As Single, y1 As Single, x2 As Single, y2 As Single, x3 As Single, y3 As Single, x4 As Single, y4 As Single)
+		SetStatus(GdipDrawBezier(nativeGraphics, pen.NativePen, x1, y1,x2, y2, x3, y3, x4, y4))
+	End Sub
+
+	Sub DrawBezier(pen As Pen, ByRef pt1 As PointF, ByRef pt2 As PointF, ByRef pt3 As PointF, ByRef pt4 As PointF)
+		DrawBezier(pen, pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y)
+	End Sub
+
+	Sub DrawBeziers(pen As Pen, points As *PointF, count As Long)
+		SetStatus(GdipDrawBeziers(nativeGraphics, pen.NativePen, points, count))
+	End Sub
+
+	Sub DrawBezier(pen As Pen, x1 As Long, y1 As Long, x2 As Long, y2 As Long, x3 As Long, y3 As Long, x4 As Long, y4 As Long)
+		SetStatus(GdipDrawBezierI(nativeGraphics, pen.NativePen, x1, y1, x2, y2, x3, y3, x4, y4))
+	End Sub
+
+	Sub DrawBezier(pen As Pen, ByRef pt1 As Point, ByRef pt2 As Point, ByRef pt3 As Point, ByRef pt4 As Point)
+		DrawBezier(pen, pt1.X, pt1.Y, pt2.X, pt2.Y, pt3.X, pt3.Y, pt4.X, pt4.Y)
+	End Sub
+
+	Sub DrawBeziers(pen As Pen, points As *Point, count As Long)
+		SetStatus(GdipDrawBeziersI(nativeGraphics, pen.NativePen, points, count))
+	End Sub
+
+	Sub DrawRectangle(pen As Pen, ByRef rect As RectangleF)
+		DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height)
+	End Sub
+
+	Sub DrawRectangle(pen As Pen, x As Single, y As Single, width As Single, height As Single)
+		SetStatus(GdipDrawRectangle(nativeGraphics, pen.NativePen, x, y, width, height))
+	End Sub
+
+	Sub DrawRectangles(pen As Pen, rects As *RectangleF, count As Long)
+		SetStatus(GdipDrawRectangles(nativeGraphics, pen.NativePen, rects, count))
+	End Sub
+
+	Sub DrawRectangle(pen As Pen, ByRef rect As Rectangle)
+		DrawRectangle(pen, rect.X, rect.Y, rect.Width, rect.Height)
+	End Sub
+
+	Sub DrawRectangle(pen As Pen, x As Long, y As Long, width As Long, height As Long)
+		SetStatus(GdipDrawRectangleI(nativeGraphics, pen.NativePen, x, y, width, height))
+	End Sub
+
+	Sub DrawRectangles(pen As Pen, rects As *Rectangle, count As Long)
+		SetStatus(GdipDrawRectanglesI(nativeGraphics, pen.NativePen, rects, count))
+	End Sub
+
+	Sub DrawEllipse(pen As Pen, ByRef rect As RectangleF)
+		DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height)
+	End Sub
+
+	Sub DrawEllipse(pen As Pen, x As Single, y As Single, width As Single, height As Single)
+		SetStatus(GdipDrawEllipse(nativeGraphics, pen.NativePen, x, y, width, height))
+	End Sub
+
+	Sub DrawEllipse(pen As Pen, ByRef rect As Rectangle)
+		DrawEllipse(pen, rect.X, rect.Y, rect.Width, rect.Height)
+	End Sub
+
+	Sub DrawEllipse(pen As Pen, x As Long, y As Long, width As Long, height As Long)
+		SetStatus(GdipDrawEllipseI(nativeGraphics, pen.NativePen, x, y, width, height))
+	End Sub
+
+	Sub DrawPie(pen As Pen, ByRef rect As RectangleF, startAngle As Single, sweepAngle As Single)
+		DrawPie(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
+	End Sub
+
+	Sub DrawPie(pen As Pen, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single)
+		SetStatus(GdipDrawPie(nativeGraphics, pen.NativePen, x, y, width, height, startAngle, sweepAngle))
+	End Sub
+
+	Sub DrawPie(pen As Pen, ByRef rect As Rectangle, startAngle As Single, sweepAngle As Single)
+		DrawPie(pen, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
+	End Sub
+
+	Sub DrawPie(pen As Pen, x As Long, y As Long, width As Long, height As Long, startAngle As Single, sweepAngle As Single)
+		SetStatus(GdipDrawPieI(nativeGraphics, pen.NativePen, x, y, width, height, startAngle, sweepAngle))
+	End Sub
+
+	Sub DrawPolygon(pen As Pen, points As *PointF, count As Long)
+		SetStatus(GdipDrawPolygon(nativeGraphics, pen.NativePen, points, count))
+	End Sub
+
+	Sub DrawPolygon(pen As Pen, points As *Point, count As Long)
+		SetStatus(GdipDrawPolygonI(nativeGraphics, pen.NativePen, points, count))
+	End Sub
+
+	Sub DrawPath(pen As Pen, path As GraphicsPath)
+		If ActiveBasic.IsNothing(pen) Or ActiveBasic.IsNothing(path) Then
+			Throw New ArgumentNullException("pen or path or both")
 		End If
-		Return SetStatus(GdipDrawString( nativeGraphics, str, length, nativeFont, layoutRect, 0, 0))
-	End Function
-
-	Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ Rectangle,
-		stringFormat As /*Const*/ StringFormat, brush As /*Const*/ Brush) As Status
-
-		Dim nativeFont As *GpFont
-		If VarPtr(font) <> 0 Then
-			nativeFont = font.nativeFormat
-		Else
-			nativeFont = 0
+		SetStatus(GdipDrawPath(nativeGraphics, pen.NativePen, path.nativePath))
+	End Sub
+
+	Sub DrawCurve(pen As Pen, points As *PointF, count As Long)
+		SetStatus(GdipDrawCurve(nativeGraphics, pen.NativePen, points, count))
+	End Sub
+
+	Sub DrawCurve(pen As Pen, points As *PointF, count As Long, tension As Single)
+		SetStatus(GdipDrawCurve2(nativeGraphics, pen.NativePen, points,count, tension))
+	End Sub
+
+	Sub DrawCurve(pen As Pen, points As *PointF, count As Long, offset As Long, numberOfSegments As Long)
+		SetStatus(GdipDrawCurve3(nativeGraphics, pen.NativePen, points, count, offset,numberOfSegments, 0.5))
+	End Sub
+
+	Sub DrawCurve(pen As Pen, points As *PointF, count As Long, offset As Long, numberOfSegments As Long, tension As Single)
+		SetStatus(GdipDrawCurve3(nativeGraphics, pen.NativePen, points, count, offset,numberOfSegments, tension))
+	End Sub
+
+	Sub DrawCurve(pen As Pen, points As *Point, count As Long)
+		SetStatus(GdipDrawCurveI(nativeGraphics, pen.NativePen, points, count))
+	End Sub
+
+	Sub DrawCurve(pen As Pen, points As *Point, count As Long, tension As Single)
+		SetStatus(GdipDrawCurve2I(nativeGraphics, pen.NativePen, points, count, tension))
+	End Sub
+
+	Sub DrawCurve(pen As Pen, points As *Point, count As Long, offset As Long, numberOfSegments As Long)
+		SetStatus(GdipDrawCurve3I(nativeGraphics, pen.NativePen, points, count, offset, numberOfSegments, 0.5))
+	End Sub
+
+	Sub DrawCurve(pen As Pen, points As *Point, count As Long, offset As Long, numberOfSegments As Long, tension As Single)
+		SetStatus(GdipDrawCurve3I(nativeGraphics, pen.NativePen, points, count, offset, numberOfSegments, tension))
+	End Sub
+
+	Sub DrawClosedCurve(pen As Pen, points As *PointF, count As Long)
+		SetStatus(GdipDrawClosedCurve(nativeGraphics, pen.NativePen, points, count))
+	End Sub
+
+	Sub DrawClosedCurve(pen As Pen, points As *PointF, count As Long, tension As Single)
+		SetStatus(GdipDrawClosedCurve2(nativeGraphics, pen.NativePen, points, count, tension))
+	End Sub
+
+	Sub DrawClosedCurve(pen As Pen, points As *Point, count As Long)
+		SetStatus(GdipDrawClosedCurveI(nativeGraphics, pen.NativePen, points, count))
+	End Sub
+
+	Sub DrawClosedCurve(pen As Pen, points As *Point, count As Long, tension As Single)
+		SetStatus(GdipDrawClosedCurve2I(nativeGraphics, pen.NativePen, points, count, tension))
+	End Sub
+
+	Sub Clear(color As Color)
+		SetStatus(GdipGraphicsClear(nativeGraphics, color))
+	End Sub
+
+	Sub FillRectangle(brush As Brush, ByRef rect As RectangleF)
+		FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height)
+	End Sub
+
+	Sub FillRectangle(brush As Brush, x As Single, y As Single, width As Single, height As Single)
+		SetStatus(GdipFillRectangle(nativeGraphics, brush.nativeBrush, x, y, width, height))
+	End Sub
+
+	Sub FillRectangles(brush As Brush, rects As *RectangleF, count As Long)
+		SetStatus(GdipFillRectangles(nativeGraphics,brush.nativeBrush,rects, count))
+	End Sub
+
+	Sub FillRectangle(brush As Brush, ByRef rect As Rectangle)
+		FillRectangle(brush, rect.X, rect.Y, rect.Width, rect.Height)
+	End Sub
+
+	Sub FillRectangle(brush As Brush, x As Long, y As Long, width As Long, height As Long)
+		SetStatus(GdipFillRectangleI(nativeGraphics, brush.nativeBrush, x, y, width, height))
+	End Sub
+
+	Sub FillRectangles(brush As Brush, rects As *Rectangle, count As Long)
+		SetStatus(GdipFillRectanglesI(nativeGraphics, brush.nativeBrush, rects, count))
+	End Sub
+
+'	Sub FillPolygon(brush As Brush, points As *PointF, count As Long)
+'		FillPolygon(brush, points, count, System.Drawing.Drawing2D.FillMode.Alternate)
+'	End Sub
+
+	Sub FillPolygon(brush As Brush, points As *PointF, count As Long, fillMode As Drawing2D.FillMode)
+		SetStatus(GdipFillPolygon(nativeGraphics, brush.nativeBrush, points, count, fillMode))
+	End Sub
+
+'	Sub FillPolygon(brush As Brush, points As *Point, count As Long)
+'		FillPolygon(brush, points, count, System.Drawing.Drawing2D.FillMode.Alternate)
+'	End Sub
+
+	Sub FillPolygon(brush As Brush, points As *Point, count As Long, fillMode As Drawing2D.FillMode)
+		SetStatus(GdipFillPolygonI(nativeGraphics, brush.nativeBrush, points, count, fillMode))
+	End Sub
+
+	Sub FillEllipse(brush As Brush, ByRef rect As RectangleF)
+		FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height)
+	End Sub
+
+	Sub FillEllipse(brush As Brush, x As Single, y As Single, width As Single, height As Single)
+		SetStatus(GdipFillEllipse(nativeGraphics, brush.nativeBrush, x, y, width, height))
+	End Sub
+
+	Sub FillEllipse(brush As Brush, ByRef rect As Rectangle)
+		FillEllipse(brush, rect.X, rect.Y, rect.Width, rect.Height)
+	End Sub
+
+	Sub FillEllipse(brush As Brush, x As Long, y As Long, width As Long, height As Long)
+		SetStatus(GdipFillEllipseI(nativeGraphics, brush.nativeBrush, x, y, width, height))
+	End Sub
+
+	Sub FillPie(brush As Brush, ByRef rect As RectangleF, startAngle As Single, sweepAngle As Single)
+		FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
+	End Sub
+
+	Sub FillPie(brush As Brush, x As Single, y As Single, width As Single, height As Single, startAngle As Single, sweepAngle As Single)
+		SetStatus(GdipFillPie(nativeGraphics, brush.nativeBrush, x, y, width, height, startAngle, sweepAngle))
+	End Sub
+
+	Sub FillPie(brush As Brush, ByRef rect As Rectangle, startAngle As Single, sweepAngle As Single)
+		FillPie(brush, rect.X, rect.Y, rect.Width, rect.Height, startAngle, sweepAngle)
+	End Sub
+
+	Sub FillPie(brush As Brush, x As Long, y As Long, width As Long, height As Long, startAngle As Single, sweepAngle As Single)
+		SetStatus(GdipFillPieI(nativeGraphics, brush.nativeBrush, x, y, width, height, startAngle, sweepAngle))
+	End Sub
+
+	Sub FillPath(brush As Brush, path As GraphicsPath)
+		If ActiveBasic.IsNothing(brush) Or ActiveBasic.IsNothing(path) Then
+			Throw New ArgumentNullException("brush or path or both")
 		End If
-		Dim nativeFormat As *GpStringFormat
-		If VarPtr(layoutRect) <> 0 Then
-			nativeFormat = layoutRect.nativeFormat
-		Else
-			nativeFormat = 0
+		SetStatus(GdipFillPath(nativeGraphics, brush.nativeBrush, path.nativePath))
+	End Sub
+
+	Sub FillClosedCurve(brush As Brush, points As *PointF, count As Long)
+		SetStatus(GdipFillClosedCurve(nativeGraphics, brush.nativeBrush, points, count))
+	End Sub
+
+	Sub FillClosedCurve(brush As Brush, points As *PointF, count As Long, fillMode As Drawing2D.FillMode)
+		SetStatus(GdipFillClosedCurve2(nativeGraphics, brush.nativeBrush, points, count, 0.5, fillMode))
+	End Sub
+
+	Sub FillClosedCurve(brush As Brush, points As *PointF, count As Long, fillMode As Drawing2D.FillMode, tension As Single)
+		SetStatus(GdipFillClosedCurve2(nativeGraphics, brush.nativeBrush, points, count, tension, fillMode))
+	End Sub
+
+	Sub FillClosedCurve(brush As Brush, points As *Point, count As Long)
+		SetStatus(GdipFillClosedCurveI(nativeGraphics, brush.nativeBrush, points, count))
+	End Sub
+
+	Sub FillClosedCurve(brush As Brush, points As *Point, count As Long, fillMode As Drawing2D.FillMode)
+		SetStatus(GdipFillClosedCurve2I(nativeGraphics, brush.nativeBrush, points, count, 0.5, fillMode))
+	End Sub
+
+	Sub FillClosedCurve(brush As Brush, points As *Point, count As Long, fillMode As Drawing2D.FillMode, tension As Single)
+		SetStatus(GdipFillClosedCurve2I(nativeGraphics, brush.nativeBrush, points, count, tension, fillMode))
+	End Sub
+
+	Sub FillRegion(brush As Brush, region As Region)
+		SetStatus(GdipFillRegion(nativeGraphics, brush.nativeBrush, region.nativeRegion))
+	End Sub
+
+'DrawStringは次の組み合わせからなる。
+'(PCWSTR, Long) or String
+'PointF or (Single, Single) or Rectangle
+'StringFormatの有無
+	Sub DrawString(str As PCWSTR, length As Long, font As Font, brush As Brush, ByRef origin As PointF, stringFormat = Nothing As StringFormat)
+		DrawString(str, length, font, brush, origin.X, origin.Y, stringFormat)
+	End Sub
+
+	Sub DrawString(str As PCWSTR, length As Long, font As Font, brush As Brush, x As Single, y As Single, stringFormat = Nothing As StringFormat)
+		Dim rc As RectangleF
+		rc.X = x
+		rc.Y = y
+		rc.Width = 0
+		rc.Height = 0
+		DrawString(str, length, font, brush, rc, stringFormat)
+	End Sub
+
+	Sub DrawString(str As PCWSTR, length As Long, font As Font, brush As Brush, ByRef layoutRect As RectangleF, stringFormat = Nothing As StringFormat)
+		Dim nativeFont = getNativeFont(font)
+		Dim nativeFormat = getNativeStringFormat(stringFormat)
+		Dim nativeBrush = getNativeBrush(brush)
+		SetStatus(GdipDrawString(nativeGraphics, str, length, nativeFont, layoutRect, nativeFormat, nativeBrush))
+	End Sub
+
+	Sub DrawString(s As String, font As Font, brush As Brush, ByRef origin As PointF, stringFormat = Nothing As StringFormat)
+		DrawString(s, font, brush, origin.X, origin.Y, stringFormat)
+	End Sub
+
+	Sub DrawString(s As String, font As Font, brush As Brush, x As Single, y As Single, stringFormat = Nothing As StringFormat)
+		Dim rc As RectangleF
+		rc.X = x
+		rc.Y = y
+		rc.Width = 0
+		rc.Height = 0
+		DrawString(s, font, brush, rc, stringFormat)
+	End Sub
+
+	Sub DrawString(s As String, font As Font, brush As Brush, ByRef layoutRect As RectangleF, stringFormat = Nothing As StringFormat)
+		Dim wcs As PCWSTR
+		Dim len = GetStr(s, wcs) As Long
+		DrawString(wcs, len As Long, font, brush, layoutRect, stringFormat)
+	End Sub
+
+	Function MeasureString(s As String, font As Font) As SizeF
+		Dim pt As PointF
+		MeasureString = MeasureString(s, font, pt, Nothing)
+	End Function
+
+	Function MeasureString(s As String, font As Font, ByRef layoutRectSize As SizeF) As SizeF
+		MeasureString = MeasureString(s, font, layoutRectSize, Nothing)
+	End Function
+
+	Function MeasureString(s As String, font As Font, ByRef layoutRectSize As SizeF, stringFormat As StringFormat) As SizeF
+		Dim wcs As PCWSTR
+		Dim len = GetStr(s, wcs) As Long
+		MeasureString = MeasureString(wcs, len, font, layoutRectSize, stringFormat)
+	End Function
+
+	Function MeasureString(s As String, font As Font, ByRef origin As PointF, stringFormat As StringFormat) As SizeF
+		Dim wcs As PCWSTR
+		Dim len = GetStr(s, wcs) As Long
+		MeasureString = MeasureString(wcs, len, font, origin, stringFormat)
+	End Function
+
+	Function MeasureString(s As String, font As Font, width As Long, stringFormat As StringFormat) As SizeF
+		Dim wcs As PCWSTR
+		Dim len = GetStr(s, wcs) As Long
+		MeasureString = MeasureString(wcs, len, font, width, stringFormat)
+	End Function
+
+	Function MeasureString(s As String, font As Font, ByRef layoutRectSize As SizeF, stringFormat As StringFormat, ByRef codepointsFitted As Long, ByRef linesFilled As Long) As SizeF
+		Dim wcs As PCWSTR
+		Dim len = GetStr(s, wcs) As Long
+		MeasureString = MeasureString(wcs, len, font, layoutRectSize, stringFormat, codepointsFitted, linesFilled)
+	End Function
+
+	Function MeasureString(str As PCWSTR, length As Long, font As Font) As SizeF
+		Dim pt As PointF
+		MeasureString = MeasureString(str, length, font, pt, Nothing)
+	End Function
+
+	Function MeasureString(str As PCWSTR, length As Long, font As Font, ByRef layoutRectSize As SizeF) As SizeF
+		MeasureString = MeasureString(str, length, font, layoutRectSize, Nothing)
+	End Function
+
+	Function MeasureString(str As PCWSTR, length As Long, font As Font, ByRef layoutRectSize As SizeF, stringFormat As StringFormat) As SizeF
+		MeasureString = measureStringPt(str, length, font, layoutRectSize, stringFormat, 0, 0)
+	End Function
+
+	Function MeasureString(str As PCWSTR, length As Long, font As Font, ByRef origin As PointF, stringFormat As StringFormat) As SizeF
+		Dim layoutRect As RectangleF
+		With layoutRect
+			.X = origin.X
+			.Y = origin.Y
+			.Width = 0
+			.Height = 0
+		End With
+		MeasureString = measureString(str, length, font, layoutRect, stringFormat, 0, 0)
+	End Function
+
+	Function MeasureString(str As PCWSTR, length As Long, font As Font, width As Long, stringFormat As StringFormat) As SizeF
+		Dim layoutRect As RectangleF
+		With layoutRect
+			.X = 0
+			.Y = 0
+			.Width = width
+			.Height = 0
+		End With
+		MeasureString = measureString(str, length, font, layoutRect, stringFormat, 0, 0)
+	End Function
+
+	Function MeasureString(str As PCWSTR, length As Long, font As Font, ByRef layoutRectSize As SizeF, stringFormat As StringFormat, ByRef codepointsFitted As Long, ByRef linesFilled As Long) As SizeF
+		MeasureString = measureStringPt(str, length, font, layoutRectSize, stringFormat, VarPtr(codepointsFitted), VarPtr(linesFilled))
+	End Function
+
+Private
+	Function measureStringPt(str As PCWSTR, length As Long, font As Font, ByRef layoutRectSize As SizeF, stringFormat As StringFormat, codepointsFitted As *Long, linesFilled As *Long) As SizeF
+		Dim layoutRect As RectangleF
+		With layoutRect
+			.X = 0
+			.Y = 0
+			.Width = layoutRectSize.Width
+			.Height = layoutRectSize.Height
+		End With
+		measureStringPt = measureString(str, length, font, layoutRect, stringFormat, codepointsFitted, linesFilled)
+	End Function
+
+	Function measureString(str As PCWSTR, length As Long, font As Font, ByRef layoutRect As RectangleF, stringFormat As StringFormat, codepointsFitted As *Long, linesFilled As *Long) As SizeF
+		Dim nativeFont = getNativeFont(font)
+		Dim nativeFormat = getNativeStringFormat(stringFormat)
+		Dim boundingBox As RectangleF
+		SetStatus(GdipMeasureString(nativeGraphics, str, length, nativeFont, layoutRect, nativeFormat, boundingBox, codepointsFitted, linesFilled))
+		measureString.Width = boundingBox.Width
+		measureString.Height = boundingBox.Height
+	End Function
+
+Public
+
+	Function MeasureCharacterRanges(s As String, font As Font, ByRef layoutRect As RectangleF, stringFormat As StringFormat) As System.Collections.Generic.IList<Region>
+		Dim wcs As PCWSTR
+		Dim len = GetStr(s, wcs)
+		MeasureCharacterRanges = MeasureCharacterRanges(wcs, len, font, layoutRect, stringFormat)
+	End Function
+
+	Function MeasureCharacterRanges(str As PCWSTR, length As Long, font As Font, ByRef layoutRect As RectangleF, stringFormat As StringFormat) As System.Collections.Generic.IList<Region>
+		If ActiveBasic.IsNothing(stringFormat) Then
+			stringFormat = New StringFormat
 		End If
-		Return SetStatus(GdipDrawString(nativeGraphics, str, length, nativeFont, layoutRect, nativeFormat, 0))
-	End Function
-
-	Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF,
-		stringFormat As /*Const*/ StringFormat, brush As /*Const*/ Brush) As Status
-
-		Dim nativeFont As *GpFont
-		If VarPtr(font) <> 0 Then
-			nativeFont = font.nativeFormat
-		Else
-			nativeFont = 0
-		End If
-		Dim nativeFormat As *GpStringFormat
-		If VarPtr(stringFormat) <> 0 Then
-			nativeFormat = stringFormat.nativeFormat
-		Else
-			nativeFormat = 0
-		End If
-		Dim nativeBrush As *GpBrush
-		If VarPtr(brush) <> 0 Then
-			nativeBrush = brush.nativeFormat
-		Else
-			nativeBrush = 0
-		End If
-		Return SetStatus(GdipDrawString(nativeGraphics, str, length, nativeFont, layoutRect, nativeFormat, nativeBrush))
-	End Function
-
-	Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, origin As /*Const*/ Point) As Status
-		Dim rect As RectangleF(origin.X, origin.Y, 0.0, 0.0)
-		Dim nativeFont As *GpFont
-		If VarPtr(font) <> 0 Then
-			nativeFont = font.nativeFormat
-		Else
-			nativeFont = 0
-		End If
-		Return SetStatus(GdipDrawString(nativeGraphics, str, length, nativeFont, rect, 0, 0))
-	End Function
-
-	Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, origin As /*Const*/ PointF,
-		brush As /*Const*/ Brush) As Status
-
-		Dim rect As RectangleF(origin.X, origin.Y, 0.0, 0.0)
-		Dim nativeFont As *GpFont
-		If VarPtr(font) <> 0 Then
-			nativeFont = font.nativeFormat
-		Else
-			nativeFont = 0
-		End If
-		Dim nativeBrush As *GpBrush
-		If VarPtr(brush) <> 0 Then
-			nativeBrush = brush.nativeFormat
-		Else
-			nativeBrush = 0
-		End If
-		Return SetStatus(GdipDrawString(nativeGraphics, str, length, nativeFont, rect, 0, nativeBrush))
-	End Function
-
-	Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, origin As /*Const*/ PointF) As Status
-		Dim rect As RectangleF(origin.X, origin.Y, 0.0, 0.0)
-		Dim nativeFont As *GpFont
-		If VarPtr(font) <> 0 Then
-			nativeFont = font.nativeFormat
-		Else
-			nativeFont = 0
-		End If
-		Return SetStatus(GdipDrawString(nativeGraphics, str, length, nativeFont, rect, 0, 0))
-	End Function
-
-	Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, origin As /*Const*/ PointF,
-		stringFormat As /*Const*/ StringFormat) As Status
-
-		Dim rect As RectangleF(origin.X, origin.Y, 0.0, 0.0)
-		Dim nativeFont As *GpFont
-		If VarPtr(font) <> 0 Then
-			nativeFont = font.nativeFormat
-		Else
-			nativeFont = 0
-		End If
-		Dim nativeFormat As *GpStringFormat
-		If VarPtr(stringFormat) <> 0 Then
-			nativeFormat = stringFormat.nativeFormat
-		Else
-			nativeFormat = 0
-		End If
-		Return SetStatus(GdipDrawString(nativeGraphics, str, length, nativeFont, rect, nativeFormat, 0))
-	End Function
-
-	Function DrawString(str As PCWSTR, length As Long, font As /*Const*/ Font, origin As /*Const*/ PointF,
-		stringFormat As /*Const*/ StringFormat, brush As /*Const*/ Brush) As Status
-
-		Dim rect As RectangleF(origin.X, origin.Y, 0.0, 0.0)
-		Dim nativeFont As *GpFont
-		If VarPtr(font) <> 0 Then
-			nativeFont = font.nativeFormat
-		Else
-			nativeFont = 0
-		End If
-		Dim nativeFormat As *GpStringFormat
-		If VarPtr(stringFormat) <> 0 Then
-			nativeFormat = stringFormat.nativeFormat
-		Else
-			nativeFormat = 0
-		End If
-		If VarPtr(brush) <> 0 Then
-			nativeBrush = brush.nativeFormat
-		Else
-			nativeBrush = 0
-		End If
-		Return SetStatus(GdipDrawString( nativeGraphics, str, length, nativeFont, rect, nativeFormat, nativeBrush))
-	End Function
-
-	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF,
-		stringFormat As /*Const*/ StringFormat, boundingBox As RectangleF) As Status
-
-		Return MeasureString(str, length, font, layoutRect, stringFormat, boundingBox, ByVal 0, ByVal 0)
-	End Function
-
-	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF,
-		stringFormat As /*Const*/ StringFormat, boundingBox As RectangleF,
-		codepointsFitted As Long) As Status
-
-		Return MeasureString(str, length, font, layoutRect, stringFormat, boundingBox, codepointsFitted, ByVal 0)
-	End Function
-
-	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font, layoutRect As /*Const*/ RectangleF,
-		stringFormat As /*Const*/ StringFormat, boundingBox As RectangleF,
-		codepointsFitted As Long, linesFilled As Long) As Status
-
-		Dim nativeFont As *GpFont
-		If VarPtr(font) <> 0 Then
-			nativeFont = font.nativeFormat
-		Else
-			nativeFont = 0
-		End If
-		Dim nativeFormat As *GpStringFormat
-		If VarPtr(stringFormat) <> 0 Then
-			nativeFormat = stringFormat.nativeFormat
-		Else
-			nativeFormat = 0
-		End If
-		Return SetStatus(GdipMeasureString(nativeGraphics, str, length, nativeFont, layoutRect, nativeFormat,
-			boundingBox, codepointsFitted, linesFilled))
-	End Function
-
-	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font,
-		layoutRectSize As /*Const*/ SizeF, stringFormat As /*Const*/ StringFormat,
-		size As SizeF) As Status
-
-			Return MeasureString(str, length, font, layoutRectSize, stringFormat, size, ByVal 0, ByVal 0)
-	End Function
-
-	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font,
-		layoutRectSize As /*Const*/ SizeF, stringFormat As /*Const*/ StringFormat,
-		size As SizeF, codepointsFitted As Long) As Status
-
-			Return MeasureString(str, length, font, layoutRectSize, stringFormat, size, codepointsFitted, ByVal 0)
-	End Function
-
-	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font,
-		layoutRectSize As /*Const*/ SizeF, stringFormat As /*Const*/ StringFormat,
-		size As SizeF, codepointsFitted As Long, linesFilled As Long) As Status
-
-		Dim layoutRect As RectangleF(0, 0, layoutRectSize.Width, layoutRectSize.Height)
-		Dim boundingBox As RectangleF, pBoundingBox As *RectangleF
-		If VarPtr(size) <> 0 Then
-			pBoundingBox = VarPtr(boundingBox)
-		Else
-			pBoundingBox = 0
-		End If
-
-		Dim nativeFont As *GpFont
-		If VarPtr(font) <> 0 Then
-			nativeFont = font.nativeFormat
-		Else
-			nativeFont = 0
-		End If
-		Dim nativeFormat As *GpStringFormat
-		If VarPtr(stringFormat) <> 0 Then
-			nativeFormat = stringFormat.nativeFormat
-		Else
-			nativeFormat = 0
-		End If
-		Dim status = SetStatus(GdipMeasureString(nativeGraphics, str, length,
-			nativeFont, layoutRect, nativeFormat, pBoundingBox, codepointsFitted, linesFilled))
-
-		If VarPtr(size) <> 0 And status = Status.Ok Then
-			size.Width  = boundingBox.Width
-			size.Height = boundingBox.Height
-		End Function
-
-		Return status
-	End Function
-
-	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font,
-		origin As /*Const*/ PointF, stringFormat As /*Const*/ StringFormat,
-		boundingBox As RectangleF) As Status
-
-		Dim rect As RectangleF(origin.X, origin.Y, 0.0f, 0.0f)
-		Dim nativeFont As *GpFont
-		If VarPtr(font) <> 0 Then
-			nativeFont = font.nativeFormat
-		Else
-			nativeFont = 0
-		End If
-		Dim nativeFormat As *GpStringFormat
-		If VarPtr(stringFormat) <> 0 Then
-			nativeFormat = stringFormat.nativeFormat
-		Else
-			nativeFormat = 0
-		End If
-
-		Return SetStatus(GdipMeasureString(nativeGraphics, str, length, nativeFont, rect, nativeFormat, boundingBox, 0, 0))
-	End Function
-
-	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font,
-		layoutRect As /*Const*/ RectangleF, boundingBox As RectangleF) As Status
-
-		Dim nativeFont As *GpFont
-		If VarPtr(font) <> 0 Then
-			nativeFont = font.nativeFormat
-		Else
-			nativeFont = 0
-		End If
-
-		Return SetStatus(GdipMeasureString(nativeGraphics, str, length, nativeFont, layoutRect, 0, boundingBox, 0, 0))
-	End Function
-
-	Const Function MeasureString(str As PCWSTR, length As Long, font As /*Const*/ Font,
-		origin As /*Const*/ PointF, boundingBox As RectangleF) As Status
-		Dim rect As RectangleF(origin.X, origin.Y, 0.0, 0.0)
-
-		Dim nativeFont As *GpFont
-		If VarPtr(font) <> 0 Then
-			nativeFont = font.nativeFormat
-		Else
-			nativeFont = 0
-		End If
-		Return SetStatus(GdipMeasureString(nativeGraphics, str, length, nativeFont, rect, 0, boundingBox, 0, 0))
-	End Function
-
-	Const Function MeasureCharacterRanges(str As PCWSTR, length As Long, font As /*Const*/ Font,
-		layoutRect As /*Const*/ RectangleF, stringFormat As /*Const*/ StringFormat,
-		regionCount As Long, regions As *Region) As Status
-		If regions = 0 Or regionCount <= 0 Then
-			Return InvalidParameter
-		End If
-
-		Dim nativeRegions = _System_malloc(regionCount * SizeOf (GpRegion*)) As **GpRegion
-
-		If nativeRegions = 0 Then
-			Return OutOfMemory
-		End If
+		Dim count As Long
+        SetStatus(GdipGetStringFormatMeasurableCharacterRangeCount(stringFormat.nativeFormat, count))
+		Dim nativeRegions As **GpRegion 'ここで = GC_mallocとすると、エラーになる。
+		nativeRegions = GC_malloc(count * SizeOf(*GpRegion))
+		Dim regions = New System.Collections.Generic.List<Region>(count)
+		MeasureCharacterRanges = regions
 
 		Dim i As Long
-		For i = 0 To regionCount
-			nativeRegions[i] = regions[i].nativeRegion
+		For i = 0 To ELM(count)
+			Dim t = regions[i]
+			nativeRegions[i] = t.nativeRegion
 		Next
-
-		Dim nativeFont As *GpFont
-		If VarPtr(font) <> 0 Then
-			nativeFont = font.nativeFormat
-		Else
-			nativeFont = 0
-		End If
-		Dim nativeFormat As *GpStringFormat
-		If VarPtr(stringFormat) <> 0 Then
-			nativeFormat = stringFormat.nativeFormat
-		Else
-			nativeFormat = 0
-		End If
-
-		Dim status = SetStatus(GdipMeasureCharacterRanges(nativeGraphics,
-			str, length, nativeFont, layoutRect, nativeFormat,regionCount, nativeRegions))
-		_System_free(nativeRegions)
-		Return status
-	End Function
-
-	Function DrawDriverString(text As /*Const*/ Word, length As Long, font As /*Const*/ Font,
-		brush As /*Const*/ Brush, positions As /*Const*/ *PointF, flags As Long) As Status
-
-		Return DrawDriverString(text, length, font, brush, positions, flags, ByVal 0)
-	End Function
-
-	Function DrawDriverString(text As /*Const*/ Word, length As Long, font As /*Const*/ Font,
-		brush As /*Const*/ Brush, positions As /*Const*/ *PointF, flags As Long, matrix As /*Const*/ Matrix) As Status
-
-		Dim nativeFont As *GpFont
-		If VarPtr(font) <> 0 Then
-			nativeFont = font.nativeFormat
-		Else
-			nativeFont = 0
-		End If
-		Dim nativeBrush As *GpBrush
-		If VarPtr(brush) <> 0 Then
-			nativeBrush = brush.nativeBrush
-		Else
-			nativeBrush = 0
-		End If
-		Dim nativeMatrix As *GpMatrix
-		If VarPtr(matrix) <> 0 Then
-			nativeMatrix = matrix.nativeMatrix
-		Else
-			nativeMatrix = 0
-		End If
-		Return SetStatus(GdipDrawDriverString(nativeGraphics, text, length, nativeFont, nativeBrush, positions, flags, nativeMatrix))
-	End Function
-
-	Const Function MeasureDriverString(text As /*Const*/ Word, length As Long, font As /*Const*/ Font,
-		positions As /*Const*/ *PointF, flags As Long, matrix As /*Const*/ Matrix, boundingBox As RectangleF) As Status
-
-		Dim nativeFont As *GpFont
-		If VarPtr(font) <> 0 Then
-			nativeFont = font.nativeFormat
-		Else
-			nativeFont = 0
-		End If
-		Dim nativeMatrix As *GpMatrix
-		If VarPtr(matrix) <> 0 Then
-			nativeMatrix = matrix.nativeMatrix
-		Else
-			nativeMatrix = 0
-		End If
-		Return SetStatus(GdipMeasureDriverString(nativeGraphics, text, length, nativeFont, positions, flags, nativeMatrix, boundingBox))
-	End Function
-
-	' Draw a cached bitmap on this graphics destination offset by
-	' x, y. Note this will fail with WrongState if the CachedBitmap
-	' native format differs from this Graphics.
-
-	Function DrawCachedBitmap(cb As CachedBitmap, x As Long, y As Long) As Status
-		Return SetStatus(GdipDrawCachedBitmap(nativeGraphics, cb->nativeCachedBitmap, x, y))
-	End Function
-
-	Function DrawImage(image As Image, point As /*Const*/ PointF) As Status
-		Return DrawImage(image, point.X, point.Y)
-	End Function
-
-	Function DrawImage(image As Image, x As Single, y As Single) As Status
-		Dim nativeImage As *GpImage
-		If VarPtr(image) <> 0 Then
-			nativeImage = image.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Return SetStatus(GdipDrawImage(nativeGraphics, nativeImage, x, y))
-	End Function
-
-	Function DrawImage(image As Image, rect As /*Const*/ RectangleF) As Status
-		Return DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height)
-	End Function
-
-	Function DrawImage(image As Image, x As Single, y As Single, width As Single, height As Single) As Status
-		Dim nativeImage As *GpImage
-		If VarPtr(image) <> 0 Then
-			nativeImage = image.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Return SetStatus(GdipDrawImageRect(nativeGraphics, nativeImage, x, y, width, height))
-	End Function
-
-	Function DrawImage(image As Image, point As /*Const*/ Point) As Status
-		Return DrawImage(image, point.X, point.Y) As Status
-	End Function
-
-	Function DrawImage(image As Image, x As Long, y As Long) As Status
-		Dim nativeImage As *GpImage
-		If VarPtr(image) <> 0 Then
-			nativeImage = image.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Return SetStatus(GdipDrawImageI(nativeGraphics, nativeImage, x, y))
-	End Function
-
-	Function DrawImage(image As Image, rect As /*Const*/ Rectangle) As Status
-		Return DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height)
-	End Function
-
-	Function DrawImage(image As Image, x As Long, y As Long, width As Long, height As Long) As Status
-		Dim nativeImage As *GpImage
-		If VarPtr(image) <> 0 Then
-			nativeImage = image.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Return SetStatus(GdipDrawImageRectI(nativeGraphics, nativeImage, x, y, width, height))
-	End Function
+		Dim nativeFont = getNativeFont(font)
+		SetStatus(GdipMeasureCharacterRanges(nativeGraphics, str, length, nativeFont, layoutRect, stringFormat.nativeFormat, count, nativeRegions))
+	End Function
+
+	'DrawDriverString
+	'MeasureDriverString
+
+	Sub DrawCachedBitmap(cb As CachedBitmap, x As Long, y As Long)
+		SetStatus(GdipDrawCachedBitmap(nativeGraphics, cb.nativeCachedBitmap, x, y))
+	End Sub
+
+	Sub DrawImage(image As Image, ByRef point As PointF)
+		DrawImage(image, point.X, point.Y)
+	End Sub
+
+	Sub DrawImage(image As Image, x As Single, y As Single)
+		Dim nativeImage = getNativeImage(image)
+		SetStatus(GdipDrawImage(nativeGraphics, nativeImage, x, y))
+	End Sub
+
+	Sub DrawImage(image As Image, ByRef rect As RectangleF)
+		DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height)
+	End Sub
+
+	Sub DrawImage(image As Image, x As Single, y As Single, width As Single, height As Single)
+		Dim nativeImage = getNativeImage(image)
+		SetStatus(GdipDrawImageRect(nativeGraphics, nativeImage, x, y, width, height))
+	End Sub
+
+	Sub DrawImage(image As Image, ByRef point As Point)
+		DrawImage(image, point.X, point.Y)
+	End Sub
+
+	Sub DrawImage(image As Image, x As Long, y As Long)
+		Dim nativeImage = getNativeImage(image)
+		SetStatus(GdipDrawImageI(nativeGraphics, nativeImage, x, y))
+	End Sub
+
+	Sub DrawImage(image As Image, ByRef rect As Rectangle)
+		DrawImage(image, rect.X, rect.Y, rect.Width, rect.Height)
+	End Sub
+
+	Sub DrawImage(image As Image, x As Long, y As Long, width As Long, height As Long)
+		Dim nativeImage = getNativeImage(image)
+		SetStatus(GdipDrawImageRectI(nativeGraphics, nativeImage, x, y, width, height))
+	End Sub
 
 	' Affine Draw Image
@@ -1112,901 +825,444 @@
 	'	   destPoints[3] <=> bottom-right corner
 
-	Function DrawImage(image As Image, destPoints As /*Const*/ PointF, count As Long) As Status
+	Sub DrawImage(image As Image, destPoints As *PointF, count As Long)
 		If count <> 3 And count <> 4 Then
-			Return SetStatus(InvalidParameter)
+			SetStatus(InvalidParameter)
 		End If
 
-		Dim nativeImage As *GpImage
-		If VarPtr(image) <> 0 Then
-			nativeImage = image.NativeImage
-		Else
-			nativeImage = 0
+		Dim nativeImage = getNativeImage(image)
+		SetStatus(GdipDrawImagePoints(nativeGraphics, nativeImage, destPoints, count))
+	End Sub
+
+	Sub DrawImage(image As Image, destPoints As *Point, count As Long)
+		If count <> 3 And count <> 4 Then
+			SetStatus(InvalidParameter)
 		End If
-		Return SetStatus(GdipDrawImagePoints(nativeGraphics, nativeImage, destPoints, count))
-	End Function
-
-	Function DrawImage(image As Image, destPoints As /*Const*/ Point, count As Long) As Status
-		If count <> 3 And count <> 4 Then
-			Return SetStatus(InvalidParameter)
-		End If
-
-		Dim nativeImage As *GpImage
-		If VarPtr(image) <> 0 Then
-			nativeImage = image.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Return SetStatus(GdipDrawImagePointsI(nativeGraphics, nativeImage, destPoints, count))
-	End Function
-
-	Function DrawImage(image As Image, x As Single, y As Single,
-		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit) As Status
-
-		Dim nativeImage As *GpImage
-		If VarPtr(image) <> 0 Then
-			nativeImage = image.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Return SetStatus(GdipDrawImagePointRect(nativeGraphics, nativeImage, x, y, srcx, srcy, srcwidth, srcheight, srcUnit))
-	End Function
-
-	Function DrawImage(image As Image, destRect As /*Const*/ RectangleF,
-		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit) As Status
-
-		Return DrawImage(image, destRect, srcx, srcy, srcwidth, srcheight, srcUnit, 0, 0, 0)
-	End Function
-
-	Function DrawImage(image As Image, destRect As /*Const*/ RectangleF,
+
+		Dim nativeImage = getNativeImage(image)
+		SetStatus(GdipDrawImagePointsI(nativeGraphics, nativeImage, destPoints, count))
+	End Sub
+
+	Sub DrawImage(image As Image, ByRef destRect As Rectangle, ByRef src As Rectangle, srcUnit As GraphicsUnit)
+		DrawImage(image, destRect, src.X, src.Y, src.Width, src.Height, srcUnit)
+	End Sub
+
+	Sub DrawImage(image As Image, ByRef destRect As RectangleF, ByRef src As RectangleF, srcUnit As GraphicsUnit)
+		DrawImage(image, destRect, src.X, src.Y, src.Width, src.Height, srcUnit)
+	End Sub
+
+	Sub DrawImage(image As Image, x As Long, y As Long, ByRef src As Rectangle, srcUnit As GraphicsUnit)
+		Dim nativeImage = getNativeImage(image)
+		SetStatus(GdipDrawImagePointRectI(nativeGraphics, nativeImage, x, y, src.X, src.Y, src.Width, src.Height, srcUnit))
+	End Sub
+
+	Sub DrawImage(image As Image, x As Single, y As Single, ByRef src As RectangleF, srcUnit As GraphicsUnit)
+		Dim nativeImage = getNativeImage(image)
+		SetStatus(GdipDrawImagePointRect(nativeGraphics, nativeImage, x, y, src.X, src.Y, src.Width, src.Height, srcUnit))
+	End Sub
+
+	Sub DrawImage(image As Image, destPoints As *Point, count As Long, ByRef src As Rectangle, srcUnit As GraphicsUnit, _
+		imageAttr = Nothing As ImageAttributes, callback = Nothing As DrawImageAbort, callbackData = 0 As VoidPtr)
+
+		Dim nativeImage = getNativeImage(image)
+		Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
+		SetStatus(GdipDrawImagePointsRectI(nativeGraphics, nativeImage, destPoints, count,
+			src.X, src.Y, src.Width, src.Height, srcUnit, nativeImageAttr, callback, callbackData))
+	End Sub
+
+	Sub DrawImage(image As Image, destPoints As *PointF, count As Long, ByRef src As RectangleF, srcUnit As GraphicsUnit,
+		imageAttr = Nothing As ImageAttributes, callback = Nothing As DrawImageAbort, callbackData = 0 As VoidPtr)
+
+		Dim nativeImage = getNativeImage(image)
+		Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
+		SetStatus(GdipDrawImagePointsRect(nativeGraphics, nativeImage, destPoints, count,
+			src.X, src.Y, src.Width, src.Height, srcUnit, nativeImageAttr, callback, callbackData))
+	End Sub
+
+	Sub DrawImage(image As Image, ByRef destRect As RectangleF,
 		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
-		imageAttributes As /*Const*/ ImageAttributes) As Status
-
-		Return DrawImage(image, destRect, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, 0, 0)
-	End Function
-
-	Function DrawImage(image As Image, destRect As /*Const*/ RectangleF,
-		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
-		imageAttributes As /*Const*/ ImageAttributes,
-		callback As DrawImageAbort) As Status
-
-		Return DrawImage(image, destRect, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, 0)
-	End Function
-
-	Function DrawImage(image As Image, destRect As /*Const*/ RectangleF,
-		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
-		imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort, callbackData As VoidPtr) As Status
-
-		Dim nativeImage As *GpImage
-		If VarPtr(image) <> 0 Then
-			nativeImage = image.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Dim nativeImageAttr As *GpImageAttributes
-		If VarPtr(imageAttributes) <> 0 Then
-			nativeImageAttr = image.NativeImageAttr
-		Else
-			nativeImageAttr = 0
-		End If
-
-		Return SetStatus(GdipDrawImageRectRect(nativeGraphics, nativeImageAttr,
+		imageAttr = Nothing As ImageAttributes, callback = Nothing As DrawImageAbort, callbackData = 0 As VoidPtr)
+
+		Dim nativeImage = getNativeImage(image)
+		Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
+		SetStatus(GdipDrawImageRectRect(nativeGraphics, nativeImageAttr,
 			destRect.X, destRect.Y, destRect.Width, destRect.Height, srcx, srcy, srcwidth, srcheight,
 			srcUnit, nativeImageAttr, callback, callbackData))
-	End Function
-
-	Function DrawImage(image As Image, destPoints As /*Const*/ PointF, count As Long,
-		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit) As Status
-
-		Return DrawImage(image, destPoints, count, srcx, srcy, srcwidth, srcheight, srcUnit, 0, 0, 0)
-	End Function
-
-	Function DrawImage(image As Image, destPoints As /*Const*/ PointF, count As Long,
-		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
-		imageAttributes As /*Const*/ ImageAttributes) As Status
-
-		Return DrawImage(image, destPoints, count, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, 0, 0)
-	End Function
-
-	Function DrawImage(image As Image, destPoints As /*Const*/ PointF, count As Long,
-		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
-		imageAttributes As /*Const*/ ImageAttributes,
-		callback As DrawImageAbort) As Status
-
-		Return DrawImage(image, destPoints, count, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, 0)
-	End Function
-
-	Function DrawImage(image As Image, destPoints As /*Const*/ PointF, count As Long,
-		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
-		imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort, callbackData As VoidPtr) As Status
-
-		Dim nativeImage As *GpImage
-		If VarPtr(image) <> 0 Then
-			nativeImage = image.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Dim nativeImageAttr As *GpImageAttributes
-		If VarPtr(imageAttributes) <> 0 Then
-			nativeImageAttr = image.NativeImageAttr
-		Else
-			nativeImageAttr = 0
-		End If
-
-		Return SetStatus(GdipDrawImagePointsRect(nativeGraphics, nativeImage, destPoints, count,
-			srcx, srcy, srcwidth, srcheight, srcUnit, nativeImageAttr, callback, callbackData))
-	End Function
-
-	Function DrawImage(image As Image, x As Long, y As Long,
-		srcx As Long, srcy As Long, srcwidth As Long, srcheight As Long, srcUnit As GraphicsUnit) As Status
-
-		Dim nativeImage As *GpImage
-		If VarPtr(image) <> 0 Then
-			nativeImage = image.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Return SetStatus(GdipDrawImagePointRectI(nativeGraphics, nativeImage, x, y, srcx, srcy, srcwidth, srcheight, srcUnit))
-	End Function
-
-	Function DrawImage(image As Image, destRect As /*Const*/ Rectangle,
-		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit) As Status
-
-		Return DrawImage(image, destRect, srcx, srcy, srcwidth, srcheight, srcUnit, 0, 0, 0)
-	End Function
-
-	Function DrawImage(image As Image, destRect As /*Const*/ Rectangle,
-		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
-		imageAttributes As /*Const*/ ImageAttributes) As Status
-
-		Return DrawImage(image, destRect, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, 0, 0)
-	End Function
-
-	Function DrawImage(image As Image, destRect As /*Const*/ Rectangle,
-		srcx As Single, srcy As Single, srcwidth As Single, srcheight As Single, srcUnit As GraphicsUnit,
-		imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort) As Status
-
-		Return DrawImage(image, destRect, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, 0)
-	End Function
-
-	Function DrawImage(image As Image, destRect As /*Const*/ Rectangle,
+	End Sub
+
+	Sub DrawImage(image As Image, ByRef destRect As Rectangle,
 		srcx As Long, srcy As Long, srcwidth As Long, srcheight As Long, srcUnit As GraphicsUnit,
-		imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort, callbackData As VoidPtr) As Status
-
-		Dim nativeImage As *GpImage
-		If VarPtr(image) <> 0 Then
-			nativeImage = image.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Dim nativeImageAttr As *GpImageAttributes
-		If VarPtr(imageAttributes) <> 0 Then
-			nativeImageAttr = image.NativeImageAttr
-		Else
-			nativeImageAttr = 0
-		End If
-
-		Return SetStatus(GdipDrawImageRectRectI(nativeGraphics, nativeImage,
+		imageAttr = Nothing As ImageAttributes, callback = Nothing As DrawImageAbort, callbackData = 0 As VoidPtr)
+
+		Dim nativeImage = getNativeImage(image)
+		Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
+		SetStatus(GdipDrawImageRectRectI(nativeGraphics, nativeImage,
 			destRect.X, destRect.Y, destRect.Width, destRect.Height,
 			srcx, srcy, srcwidth, srcheight, srcUnit, nativeImageAttr, callback, callbackData))
-	End Function
-
-	Function DrawImage(image As Image, destPoints As /*Const*/ Point, count As Long,
-		srcx As Long, srcy As Long, srcwidth As Long, srcheight As Long, srcUnit As GraphicsUnit) As Status
-
-		Return DrawImage(image, destPoints, count, srcx, srcy, srcwidth, srcheight, srcUnit, 0, 0, 0)
-	End Function
-
-	Function DrawImage(image As Image, destPoints As /*Const*/ Point, count As Long,
-		srcx As Long, srcy As Long, srcwidth As Long, srcheight As Long, srcUnit As GraphicsUnit,
-		imageAttributes As /*Const*/ ImageAttributes) As Status
-
-		Return DrawImage(image, destPoints, count, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, 0, 0)
-	End Function
-
-	Function DrawImage(image As Image, destPoints As /*Const*/ Point, count As Long, _
-		srcx As Long, srcy As Long, srcwidth As Long, srcheight As Long, srcUnit As GraphicsUnit, _
-		imageAttributes As /*Const*/ ImageAttributes,
-		callback As DrawImageAbort) As Status
-
-		Return DrawImage(image, destPoints, count, srcx, srcy, srcwidth, srcheight, srcUnit, imageAttributes, callback, 0)
-	End Function
-
-	Function DrawImage(image As Image, destPoints As /*Const*/ Point, count As Long,
-		srcx As Long, srcy As Long, srcwidth As Long, srcheight As Long, srcUnit As GraphicsUnit,
-		imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort, callbackData As VoidPtr) As Status
-
-		Dim nativeImage As *GpImage
-		If VarPtr(image) <> 0 Then
-			nativeImage = image.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Dim nativeImageAttr As *GpImageAttributes
-		If VarPtr(imageAttributes) <> 0 Then
-			nativeImageAttr = image.NativeImageAttr
-		Else
-			nativeImageAttr = 0
-		End If
-
-		Return SetStatus(GdipDrawImagePointsRectI(nativeGraphics, nativeImage, destPoints, count,
-			srcx, srcy, srcwidth, srcheight, srcUnit, nativeImageAttr, callback, callbackData))
-	End Function
-
-	Function DrawImage(image As Image, destPoints As /*Const*/ *Point, count As Long, srcRect As Rectangle, srcUnit As GraphicsUnit) As Status
-		Return DrawImage(image, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit)
-	End Function
-
-	Function DrawImage(image As Image, destPoints As /*Const*/ *PointF, count As Long, srcRect As RectangleF, srcUnit As GraphicsUnit) As Status
-		Return DrawImage(image, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit)
-	End Function
-
-	Function DrawImage(image As Image, x As Long, y As Long, srcRect As Rectangle, srcUnit As GraphicsUnit) As Status
-		Return DrawImage(image, x, y, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit)
-	End Function
-
-	Function DrawImage(image As Image, x As Single, y As Single, srcRect As RectangleF, srcUnit As GraphicsUnit) As Status
-		Return DrawImage(image, x, y, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit)
-	End Function
-
-	Function DrawImage(image As Image, destPoints As /*Const*/ *Point, count As Long, srcRect As Rectangle, srcUnit As GraphicsUnit, imageAttributes As /*Const*/ ImageAttributes) As Status
-		Return DrawImage(image, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit, imageAttributes)
-	End Function
-
-	Function DrawImage(image As Image, destPoints As /*Const*/ *PointF, count As Long, srcRect As RectangleF, srcUnit As GraphicsUnit, imageAttributes As /*Const*/ ImageAttributes) As Status
-		Return DrawImage(image, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit, imageAttributes)
-	End Function
-
-	Function DrawImage(image As Image, destPoints As /*Const*/ *Point, count As Long, srcRect As Rectangle, srcUnit As GraphicsUnit, imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort) As Status
-		Return DrawImage(image, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit, imageAttributes, callback)
-	End Function
-
-	Function DrawImage(image As Image, destPoints As /*Const*/ *PointF, count As Long, srcRect As RectangleF, srcUnit As GraphicsUnit, imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort) As Status
-		Return DrawImage(image, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit, imageAttributes, callback)
-	End Function
-
-	Function DrawImage(image As Image, destPoints As /*Const*/ *Point, count As Long, srcRect As Rectangle, srcUnit As GraphicsUnit, imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort, callbackData As VoidPtr) As Status
-		Return DrawImage(image, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit, imageAttributes, callback, callbackData)
-	End Function
-
-	Function DrawImage(image As Image, destPoints As /*Const*/ *PointF, count As Long, srcRect As RectangleF, srcUnit As GraphicsUnit, imageAttributes As /*Const*/ ImageAttributes, callback As DrawImageAbort, callbackData As VoidPtr) As Status
-		Return DrawImage(image, destPoints, count, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, srcUnit, imageAttributes, callback, callbackData)
-	End Function
-
-	' The following methods are for playing an EMF+ to a graphics
-	' via the enumeration interface.  Each record of the EMF+ is
-	' sent to the callback (along with the callbackData).	Then
-	' the callback can invoke the Metafile::PlayRecord method
-	' to play the particular record.
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoint As /*Const*/ PointF,
-		callback As EnumerateMetafileProc) As Status
-
-		Return EnumerateMetafile(metafile, destPoint, callback, 0, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoint As /*Const*/ PointF,
-		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
-
-		Return EnumerateMetafile(metafile, destPoint, callback, callbackData, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoint As /*Const*/ PointF,
-		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
-
-		Dim nativeImage As /*Const*/ *GpMetafile
-		If VarPtr(metafile) <> 0 Then
-			nativeImage = metafile.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Dim nativeImageAttr As *GpImageAttributes
-		If VarPtr(imageAttributes) <> 0 Then
-			nativeImageAttr = image.NativeImageAttr
-		Else
-			nativeImageAttr = 0
-		End If
-
-		Return SetStatus(GdipEnumerateMetafileDestPoint(nativeGraphics,
-			nativeImage, destPoint, callback, callbackData,nativeImageAttr))
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoint As /*Const*/ Point,
-		callback As EnumerateMetafileProc) As Status
-
-		Return EnumerateMetafile(metafile, destPoint, callback, 0, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoint As /*Const*/ Point,
-		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
-
-		Return EnumerateMetafile(metafile, destPoint, callback, callbackData, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoint As /*Const*/ Point,
-		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
-
-		Dim nativeImage As /*Const*/ *GpMetafile
-		If VarPtr(metafile) <> 0 Then
-			nativeImage = metafile.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Dim nativeImageAttr As *GpImageAttributes
-		If VarPtr(imageAttributes) <> 0 Then
-			nativeImageAttr = image.NativeImageAttr
-		Else
-			nativeImageAttr = 0
-		End If
-
-		Return SetStatus(GdipEnumerateMetafileDestPointI(nativeGraphics,
-			nativeImage, destPoint, callback, callbackData,nativeImageAttr))
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destRect As /*Const*/ RectangleF,
-		callback As EnumerateMetafileProc) As Status
-
-		Return EnumerateMetafile(metafile, destRect, callback, 0, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destRect As /*Const*/ RectangleF,
-		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
-
-		Return EnumerateMetafile(metafile, destRect, callback, callbackData, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destRect As /*Const*/ RectangleF,
-		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
-
-		Dim nativeImage As /*Const*/ *GpMetafile
-		If VarPtr(metafile) <> 0 Then
-			nativeImage = metafile.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Dim nativeImageAttr As *GpImageAttributes
-		If VarPtr(imageAttributes) <> 0 Then
-			nativeImageAttr = image.NativeImageAttr
-		Else
-			nativeImageAttr = 0
-		End If
-
-		Return SetStatus(GdipEnumerateMetafileDestRect(nativeGraphics,
-			nativeImage, destRect, callback, callbackData, nativeImageAttr))
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destRect As /*Const*/ Rectangle,
-		callback As EnumerateMetafileProc) As Status
-
-		Return EnumerateMetafile(metafile, destRect, callback, 0, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destRect As /*Const*/ Rectangle,
-		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
-
-		Return EnumerateMetafile(metafile, destRect, callback, callbackData, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destRect As /*Const*/ Rectangle,
-		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
-
-		Dim nativeImage As /*Const*/ *GpMetafile
-		If VarPtr(metafile) <> 0 Then
-			nativeImage = metafile.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Dim nativeImageAttr As *GpImageAttributes
-		If VarPtr(imageAttributes) <> 0 Then
-			nativeImageAttr = image.NativeImageAttr
-		Else
-			nativeImageAttr = 0
-		End If
-
-		Return SetStatus(GdipEnumerateMetafileDestRectI(nativeGraphics,
-			nativeImage, destRect, callback, callbackData, nativeImageAttr))
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoints As /*Const*/ *PointF, count As Long,
-		callback As EnumerateMetafileProc) As Status
-
-		Return EnumerateMetafile(metafile, destPoints, count, callback, 0, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoints As /*Const*/ *PointF, count As Long,
-		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
-
-		Return EnumerateMetafile(metafile, destPoints, count, callback, callbackData, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoints As /*Const*/ *PointF, count As Long,
-		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
-
-		Dim nativeImage As /*Const*/ *GpMetafile
-		If VarPtr(metafile) <> 0 Then
-			nativeImage = metafile.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Dim nativeImageAttr As *GpImageAttributes
-		If VarPtr(imageAttributes) <> 0 Then
-			nativeImageAttr = image.NativeImageAttr
-		Else
-			nativeImageAttr = 0
-		End If
-
-		Return SetStatus(GdipEnumerateMetafileDestPoints(nativeGraphics,
-			nativeImage,destPoints, count, callback, callbackData, nativeImageAttr))
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoints As /*Const*/ *Point, count As Long,
-		callback As EnumerateMetafileProc) As Status
-
-		Return EnumerateMetafile(metafile, destPoints, count, callback, 0, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoints As /*Const*/ *Point, count As Long,
-		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
-
-		Return EnumerateMetafile(metafile, destPoints, count, callback, callbackData, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, destPoints As /*Const*/ *Point, count As Long,
-		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
-
-		Dim nativeImage As /*Const*/ *GpMetafile
-		If VarPtr(metafile) <> 0 Then
-			nativeImage = metafile.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Dim nativeImageAttr As *GpImageAttributes
-		If VarPtr(imageAttributes) <> 0 Then
-			nativeImageAttr = image.NativeImageAttr
-		Else
-			nativeImageAttr = 0
-		End If
-
-		Return SetStatus(GdipEnumerateMetafileDestPointsI(nativeGraphics,
-			nativeImage,destPoints, count, callback, callbackData, nativeImageAttr))
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile,
-		destPoint As /*Const*/ PointF, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit,
-		callback As EnumerateMetafileProc) As Status
-
-		Return EnumerateMetafile(metafile, destPoint, count, srcUnit, callback, 0, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile,
-		destPoint As /*Const*/ PointF, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit,
-		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
-
-		Return EnumerateMetafile(metafile, destPoint, srcRect, srcUnit, callback, callbackData, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile,
-		destPoint As /*Const*/ PointF, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit,
-		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
-
-		Dim nativeImage As /*Const*/ *GpMetafile
-		If VarPtr(metafile) <> 0 Then
-			nativeImage = metafile.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Dim nativeImageAttr As *GpImageAttributes
-		If VarPtr(imageAttributes) <> 0 Then
-			nativeImageAttr = image.NativeImageAttr
-		Else
-			nativeImageAttr = 0
-		End If
-
-		Return SetStatus(GdipEnumerateMetafileSrcRectDestPoint(nativeGraphics, _
-			nativeImage, destPoint, srcRect, srcUnit, callback, callbackData, nativeImageAttr))
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
-		destPoint As /*Const*/ Point, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
-		callback As EnumerateMetafileProc) As Status
-
-		Return EnumerateMetafile(metafile, destPoint, count, srcUnit, callback, 0, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
-		destPoint As /*Const*/ Point, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
-		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
-
-		Return EnumerateMetafile(metafile, destPoint, srcRect, srcUnit, callback, callbackData, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
-		destPoint As /*Const*/ Point, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
-		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
-
-		Dim nativeImage As /*Const*/ *GpMetafile
-		If VarPtr(metafile) <> 0 Then
-			nativeImage = metafile.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Dim nativeImageAttr As *GpImageAttributes
-		If VarPtr(imageAttributes) <> 0 Then
-			nativeImageAttr = image.NativeImageAttr
-		Else
-			nativeImageAttr = 0
-		End If
-
-		Return SetStatus(GdipEnumerateMetafileSrcRectDestPointI(nativeGraphics, _
-			nativeImage, destPoint, srcRect, srcUnit, callback, callbackData, nativeImageAttr))
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
-		destRect As /*Const*/ RectangleF, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit, _
-		callback As EnumerateMetafileProc) As Status
-
-		Return EnumerateMetafile(metafile, destRect, count, srcUnit, callback, 0, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
-		destRect As /*Const*/ RectangleF, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit, _
-		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
-
-		Return EnumerateMetafile(metafile, destRect, srcRect, srcUnit, callback, callbackData, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
-		destRect As /*Const*/ RectangleF, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit, _
-		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
-
-		Dim nativeImage As /*Const*/ *GpMetafile
-		If VarPtr(metafile) <> 0 Then
-			nativeImage = metafile.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Dim nativeImageAttr As *GpImageAttributes
-		If VarPtr(imageAttributes) <> 0 Then
-			nativeImageAttr = image.NativeImageAttr
-		Else
-			nativeImageAttr = 0
-		End If
-
-		Return SetStatus(GdipEnumerateMetafileSrcRectDestRect(nativeGraphics, _
-			nativeImage, destRect, srcRect, srcUnit, callback, callbackData, nativeImageAttr))
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
-		destRect As /*Const*/ Rectangle, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
-		callback As EnumerateMetafileProc) As Status
-
-		Return EnumerateMetafile(metafile, destRect, srcRect, srcUnit, callback, 0, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
-		destRect As /*Const*/ Rectangle, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
-		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
-
-		Return EnumerateMetafile(metafile, destRect, srcRect, srcUnit, callback, callbackData, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
-		destRect As /*Const*/ Rectangle, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
-		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
-
-		Dim nativeImage As /*Const*/ *GpMetafile
-		If VarPtr(metafile) <> 0 Then
-			nativeImage = metafile.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Dim nativeImageAttr As *GpImageAttributes
-		If VarPtr(imageAttributes) <> 0 Then
-			nativeImageAttr = image.NativeImageAttr
-		Else
-			nativeImageAttr = 0
-		End If
-
-		Return SetStatus(GdipEnumerateMetafileSrcRectDestRectI(nativeGraphics, _
-			nativeImage, destRect, srcRect, srcUnit, callback, callbackData, nativeImageAttr))
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
-		destPoints As /*Const*/ *PointF, count As Long, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit, _
-		callback As EnumerateMetafileProc) As Status
-
-		Return EnumerateMetafile(metafile, destPoints, count, srcRect, srcUnit, callback, 0, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
-		destPoints As /*Const*/ *PointF, count As Long, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit, _
-		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
-
-		Return EnumerateMetafile(metafile, destPoints, count, srcRect, srcUnit, callback, callbackData, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
-		destPoints As /*Const*/ *PointF, count As Long, srcRect As /*Const*/ RectangleF, srcUnit As GraphicsUnit, _
-		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
-
-		Dim nativeImage As /*Const*/ *GpMetafile
-		If VarPtr(metafile) <> 0 Then
-			nativeImage = metafile.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Dim nativeImageAttr As *GpImageAttributes
-		If VarPtr(imageAttributes) <> 0 Then
-			nativeImageAttr = image.NativeImageAttr
-		Else
-			nativeImageAttr = 0
-		End If
-
-		Return SetStatus(GdipEnumerateMetafileSrcRectDestPoints(nativeGraphics, _
-			nativeImage, destPoints, count, srcRect, srcUnit, callback, callbackData, nativeImageAttr))
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
-		destPoints As /*Const*/ *Point, count As Long, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
-		callback As EnumerateMetafileProc) As Status
-
-		Return EnumerateMetafile(metafile, destPoints, count, srcRect, srcUnit, callback, 0, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
-		destPoints As /*Const*/ *Point, count As Long, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
-		callback As EnumerateMetafileProc, callbackData As VoidPtr) As Status
-
-		Return EnumerateMetafile(metafile, destPoints, count, srcRect, srcUnit, callback, callbackData, 0)
-	End Function
-
-	Function EnumerateMetafile(metafile As /*Const*/ Metafile, _
-		destPoints As /*Const*/ *Point, count As Long, srcRect As /*Const*/ Rectangle, srcUnit As GraphicsUnit, _
-		callback As EnumerateMetafileProc, callbackData As VoidPtr, imageAttributes As /*Const*/ ImageAttributes) As Status
-
-		Dim nativeImage As /*Const*/ *GpMetafile
-		If VarPtr(metafile) <> 0 Then
-			nativeImage = metafile.NativeImage
-		Else
-			nativeImage = 0
-		End If
-		Dim nativeImageAttr As *GpImageAttributes
-		If VarPtr(imageAttributes) <> 0 Then
-			nativeImageAttr = image.NativeImageAttr
-		Else
-			nativeImageAttr = 0
-		End If
-
-		Return SetStatus(GdipEnumerateMetafileSrcRectDestPointsI(nativeGraphics, nativeImage, _
-			destPoints, count, srcRect, srcUnit, callback, callbackData, nativeImageAttr))
-	End Function
-
-	Function SetClip(g As /*Const*/ Graphics) As Status
-		Return SetClip(g, CombineMode.Replace)
-	End Function
-
-	Function SetClip(rc As /*Const*/ RectangleF) As Status
-		Return SetStatus(GdipSetClipRect(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, CombineMode.Replace))
-	End Function
-
-	Function SetClip(rc As /*Const*/ Rectangle) As Status
-		Return SetStatus(GdipSetClipRectI(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, CombineMode.Replace))
-	End Function
-
-	Function SetClip(path As /*Const*/ GraphicsPath) As Status
-		Return SetStatus(GdipSetClipPath(nativeGraphics, path->nativePath, CombineMode.Replace))
-	End Function
-
-	Function SetClip(region As /*Const*/ Region) As Status
-		Return SetStatus(GdipSetClipRegion(nativeGraphics, region->nativeRegion, CombineMode.Replace))
-	End Function
-
-	Function SetClip(g As /*Const*/ Graphics, combineMode As CombineMode) As Status
-		Return SetStatus(GdipSetClipGraphics(nativeGraphics, g->nativeGraphics, combineMode))
-	End Function
-
-	Function SetClip(rc As /*Const*/ RectangleF, combineMode As CombineMode) As Status
-		Return SetStatus(GdipSetClipRect(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, combineMode))
-	End Function
-
-	Function SetClip(rc As /*Const*/ Rectangle, combineMode As CombineMode) As Status
-		Return SetStatus(GdipSetClipRectI(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, combineMode))
-	End Function
-
-	Function SetClip(path As /*Const*/ GraphicsPath, combineMode As CombineMode) As Status
-		Return SetStatus(GdipSetClipPath(nativeGraphics, path->nativePath, combineMode))
-	End Function
-
-	Function SetClip(region As /*Const*/ Region, combineMode As CombineMode) As Status
-		Return SetStatus(GdipSetClipRegion(nativeGraphics, region->nativeRegion, combineMode))
-	End Function
-
-	' This is different than the other SetClip methods because it assumes
-	' that the HRGN is already in device units, so it doesn't transform
-	' the coordinates in the HRGN.
-
-	Function SetClip(hrgn As HRGN, combineMode As CombineMode /* = CombineModeReplace*/) As Status
-		Return SetStatus(GdipSetClipHrgn(nativeGraphics, hrgn, combineMode))
-	End Function
-
-	Function IntersectClip(rc As /*Const*/ RectangleF) As Status
-		Return SetStatus(GdipSetClipRect(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, CombineMode.Intersect))
-	End Function
-
-	Function IntersectClip(rc As /*Const*/ Rectangle) As Status
-		Return SetStatus(GdipSetClipRectI(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, CombineMode.Intersect))
-	End Function
-
-	Function IntersectClip(region As /*Const*/ Region) As Status
-		Return SetStatus(GdipSetClipRegion(nativeGraphics, region->nativeRegion, CombineMode.Intersect))
-	End Function
-
-	Function ExcludeClip(rc As /*Const*/ RectangleF) As Status
-		Return SetStatus(GdipSetClipRect(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, CombineMode.Exclude))
-	End Function
-
-	Function ExcludeClip(rc As /*Const*/ Rectangle) As Status
-		Return SetStatus(GdipSetClipRectI(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, CombineMode.Exclude))
-	End Function
-
-	Function ExcludeClip(region As /*Const*/ Region) As Status
-		Return SetStatus(GdipSetClipRegion(nativeGraphics, region->nativeRegion, CombineMode.Exclude))
-	End Function
-
-	Function ResetClip() As Status
-		Return SetStatus(GdipResetClip(nativeGraphics))
-	End Function
-
-	Function TranslateClip(dx As Single, dy As Single) As Status
-		Return SetStatus(GdipTranslateClip(nativeGraphics, dx, dy))
-	End Function
-
-	Function TranslateClip(dx As Long, dy As Long) As Status
-		Return SetStatus(GdipTranslateClipI(nativeGraphics, dx, dy))
-	End Function
-
-	Const Function GetClip(region As Region) As Status
-		Return SetStatus(GdipGetClip(nativeGraphics, region->nativeRegion))
-	End Function
-
-	Const Function GetClipBounds(rc As RectangleF) As Status
-		Return SetStatus(GdipGetClipBounds(nativeGraphics, rc))
-	End Function
-
-	Const Function GetClipBounds(rc As Rectangle) As Status
-		Return SetStatus(GdipGetClipBoundsI(nativeGraphics, rc))
-	End Function
-
-	Const Function GetVisibleClipBounds(rc As RectangleF) As Status
-		Return SetStatus(GdipGetVisibleClipBounds(nativeGraphics, rc))
-	End Function
-
-	Const Function GetVisibleClipBounds(rc As Rectangle) As Status
-		Return SetStatus(GdipGetVisibleClipBoundsI(nativeGraphics, rc))
-	End Function
-
-	Const Function IsVisible(x As Long, y As Long) As BOOL
+	End Sub
+
+	Sub EnumerateMetafile(metafile As Metafile, ByRef destPoint As PointF,
+		callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
+
+		Dim nativeImage = getNativeImage(metafile)
+		Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
+		Dim procData As Detail.EnumerateMetafileProcData
+		procData.Proc = callback
+		procData.Data = callbackData
+		SetStatus(GdipEnumerateMetafileDestPoint(nativeGraphics,
+			nativeImage, destPoint, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
+	End Sub
+
+	Sub EnumerateMetafile(metafile As Metafile, ByRef destPoint As Point,
+		callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
+
+		Dim nativeImage = getNativeImage(metafile)
+		Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
+		Dim procData As Detail.EnumerateMetafileProcData
+		procData.Proc = callback
+		procData.Data = callbackData
+		SetStatus(GdipEnumerateMetafileDestPointI(nativeGraphics,
+			nativeImage, destPoint, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
+	End Sub
+
+	Sub EnumerateMetafile(metafile As Metafile, ByRef destRect As RectangleF,
+		callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
+
+		Dim nativeImage = getNativeImage(metafile)
+		Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
+		Dim procData As Detail.EnumerateMetafileProcData
+		procData.Proc = callback
+		procData.Data = callbackData
+		SetStatus(GdipEnumerateMetafileDestRect(nativeGraphics,
+			nativeImage, destRect, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
+	End Sub
+
+	Sub EnumerateMetafile(metafile As Metafile, ByRef destRect As Rectangle,
+		callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
+
+		Dim nativeImage = getNativeImage(metafile)
+		Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
+		Dim procData As Detail.EnumerateMetafileProcData
+		procData.Proc = callback
+		procData.Data = callbackData
+		SetStatus(GdipEnumerateMetafileDestRectI(nativeGraphics,
+			nativeImage, destRect, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
+	End Sub
+
+	Sub EnumerateMetafile(metafile As Metafile, destPoints As *PointF, count As Long,
+		callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
+
+		Dim nativeImage = getNativeImage(metafile)
+		Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
+		Dim procData As Detail.EnumerateMetafileProcData
+		procData.Proc = callback
+		procData.Data = callbackData
+		SetStatus(GdipEnumerateMetafileDestPoints(nativeGraphics,
+			nativeImage,destPoints, count, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
+	End Sub
+
+	Sub EnumerateMetafile(metafile As Metafile, destPoints As *Point, count As Long,
+		callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
+
+		Dim nativeImage = getNativeImage(metafile)
+		Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
+		Dim procData As Detail.EnumerateMetafileProcData
+		procData.Proc = callback
+		procData.Data = callbackData
+		SetStatus(GdipEnumerateMetafileDestPointsI(nativeGraphics,
+			nativeImage,destPoints, count, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
+	End Sub
+
+	Sub EnumerateMetafile(metafile As Metafile,
+		ByRef destPoint As PointF, ByRef srcRect As RectangleF, srcUnit As GraphicsUnit,
+		callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
+
+		Dim nativeImage = getNativeImage(metafile)
+		Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
+		Dim procData As Detail.EnumerateMetafileProcData
+		procData.Proc = callback
+		procData.Data = callbackData
+		SetStatus(GdipEnumerateMetafileSrcRectDestPoint(nativeGraphics,
+			nativeImage, destPoint, srcRect, srcUnit, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
+	End Sub
+
+	Sub EnumerateMetafile(metafile As Metafile,
+		ByRef destPoint As Point, ByRef srcRect As Rectangle, srcUnit As GraphicsUnit,
+		callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
+
+		Dim nativeImage = getNativeImage(metafile)
+		Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
+		Dim procData As Detail.EnumerateMetafileProcData
+		procData.Proc = callback
+		procData.Data = callbackData
+		SetStatus(GdipEnumerateMetafileSrcRectDestPointI(nativeGraphics,
+			nativeImage, destPoint, srcRect, srcUnit, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
+	End Sub
+
+	Sub EnumerateMetafile(metafile As Metafile,
+		ByRef destRect As RectangleF, ByRef srcRect As RectangleF, srcUnit As GraphicsUnit,
+		callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
+
+		Dim nativeImage = getNativeImage(metafile)
+		Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
+		Dim procData As Detail.EnumerateMetafileProcData
+		procData.Proc = callback
+		procData.Data = callbackData
+		SetStatus(GdipEnumerateMetafileSrcRectDestRect(nativeGraphics,
+			nativeImage, destRect, srcRect, srcUnit, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
+	End Sub
+
+	Sub EnumerateMetafile(metafile As Metafile,
+		ByRef destRect As Rectangle, ByRef srcRect As Rectangle, srcUnit As GraphicsUnit,
+		callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
+
+		Dim nativeImage = getNativeImage(metafile)
+		Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
+		Dim procData As Detail.EnumerateMetafileProcData
+		procData.Proc = callback
+		procData.Data = callbackData
+		SetStatus(GdipEnumerateMetafileSrcRectDestRectI(nativeGraphics,
+			nativeImage, destRect, srcRect, srcUnit, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
+	End Sub
+
+	Sub EnumerateMetafile(metafile As Metafile,
+		destPoints As *PointF, count As Long, ByRef srcRect As RectangleF, srcUnit As GraphicsUnit,
+		callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
+
+		Dim nativeImage = getNativeImage(metafile)
+		Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
+		Dim procData As Detail.EnumerateMetafileProcData
+		procData.Proc = callback
+		procData.Data = callbackData
+		SetStatus(GdipEnumerateMetafileSrcRectDestPoints(nativeGraphics,
+			nativeImage, destPoints, count, srcRect, srcUnit, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
+	End Sub
+
+	Sub EnumerateMetafile(metafile As Metafile,
+		destPoints As *Point, count As Long, ByRef srcRect As Rectangle, srcUnit As GraphicsUnit,
+		callback As EnumerateMetafileProc, callbackData = 0 As VoidPtr, imageAttr = Nothing As ImageAttributes)
+
+		Dim nativeImage = getNativeImage(metafile)
+		Dim nativeImageAttr = getNativeImageAttributes(imageAttr)
+		Dim procData As Detail.EnumerateMetafileProcData
+		procData.Proc = callback
+		procData.Data = callbackData
+		SetStatus(GdipEnumerateMetafileSrcRectDestPointsI(nativeGraphics, nativeImage,
+			destPoints, count, srcRect, srcUnit, AddressOf(Detail.NativeEnumerateMetafileProcEntry), VarPtr(procData), nativeImageAttr))
+	End Sub
+
+	Sub SetClip(g As Graphics)
+		SetClip(g, System.Drawing.Drawing2D.CombineMode.Replace)
+	End Sub
+
+	Sub SetClip(g As Graphics, combineMode As Drawing2D.CombineMode)
+		SetStatus(GdipSetClipGraphics(nativeGraphics, g.nativeGraphics, combineMode))
+	End Sub
+
+	Sub SetClip(ByRef rc As RectangleF)
+		SetClip(rc, System.Drawing.Drawing2D.CombineMode.Replace)
+	End Sub
+
+	Sub SetClip(ByRef rc As RectangleF, combineMode As Drawing2D.CombineMode)
+		SetStatus(GdipSetClipRect(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, combineMode))
+	End Sub
+
+	Sub SetClip(ByRef rc As Rectangle)
+		SetClip(rc, System.Drawing.Drawing2D.CombineMode.Replace)
+	End Sub
+
+	Sub SetClip(ByRef rc As Rectangle, combineMode As Drawing2D.CombineMode)
+		SetStatus(GdipSetClipRectI(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, combineMode))
+	End Sub
+
+	Sub SetClip(path As GraphicsPath)
+		SetClip(path, System.Drawing.Drawing2D.CombineMode.Replace)
+	End Sub
+
+	Sub SetClip(path As GraphicsPath, combineMode As Drawing2D.CombineMode)
+		SetStatus(GdipSetClipPath(nativeGraphics, path.nativePath, combineMode))
+	End Sub
+
+	Sub SetClip(region As Region)
+		SetClip(region, System.Drawing.Drawing2D.CombineMode.Replace)
+	End Sub
+
+	Sub SetClip(region As Region, combineMode As Drawing2D.CombineMode)
+		SetStatus(GdipSetClipRegion(nativeGraphics, region.nativeRegion, combineMode))
+	End Sub
+
+	Sub SetClip(hrgn As HRGN)
+		SetClip(hrgn, System.Drawing.Drawing2D.CombineMode.Replace)
+	End Sub
+
+	Sub SetClip(hrgn As HRGN, combineMode As Drawing2D.CombineMode)
+		SetStatus(GdipSetClipHrgn(nativeGraphics, hrgn, combineMode))
+	End Sub
+
+	Sub IntersectClip(ByRef rc As RectangleF)
+		SetStatus(GdipSetClipRect(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, System.Drawing.Drawing2D.CombineMode.Intersect))
+	End Sub
+
+	Sub IntersectClip(ByRef rc As Rectangle)
+		SetStatus(GdipSetClipRectI(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, System.Drawing.Drawing2D.CombineMode.Intersect))
+	End Sub
+
+	Sub IntersectClip(region As Region)
+		SetStatus(GdipSetClipRegion(nativeGraphics, region.nativeRegion, System.Drawing.Drawing2D.CombineMode.Intersect))
+	End Sub
+
+	Sub ExcludeClip(ByRef rc As RectangleF)
+		SetStatus(GdipSetClipRect(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, System.Drawing.Drawing2D.CombineMode.Exclude))
+	End Sub
+
+	Sub ExcludeClip(ByRef rc As Rectangle)
+		SetStatus(GdipSetClipRectI(nativeGraphics, rc.X, rc.Y, rc.Width, rc.Height, System.Drawing.Drawing2D.CombineMode.Exclude))
+	End Sub
+
+	Sub ExcludeClip(region As Region)
+		SetStatus(GdipSetClipRegion(nativeGraphics, region.nativeRegion, System.Drawing.Drawing2D.CombineMode.Exclude))
+	End Sub
+
+	Sub ResetClip()
+		SetStatus(GdipResetClip(nativeGraphics))
+	End Sub
+
+	Sub TranslateClip(dx As Single, dy As Single)
+		SetStatus(GdipTranslateClip(nativeGraphics, dx, dy))
+	End Sub
+
+	Sub TranslateClip(dx As Long, dy As Long)
+		SetStatus(GdipTranslateClipI(nativeGraphics, dx, dy))
+	End Sub
+
+	Const Function IsVisible(x As Long, y As Long) As Boolean
 		Dim b = FALSE As BOOL
 		SetStatus(GdipIsVisiblePointI(nativeGraphics, x, y, b))
-		Return b
-	End Function
-
-	Const Function IsVisible(pt As /*Const*/ Point) As BOOL
-		Return IsVisible(pt.X, pt.Y)
-	End Function
-
-	Const Function IsVisible(x As Long, y As Long, width As Long, height As Long) As BOOL
+		IsVisible = b As Boolean
+	End Function
+
+	Const Function IsVisible(ByRef pt As Point) As Boolean
+		IsVisible(pt.X, pt.Y)
+	End Function
+
+	Const Function IsVisible(x As Long, y As Long, width As Long, height As Long) As Boolean
 		Dim b = FALSE As BOOL
 		SetStatus(GdipIsVisibleRectI(nativeGraphics, x, y, width, height, b))
-		Return b
-	End Function
-
-	Const Function IsVisible(rc As /*Const*/ Rectangle) As BOOL
-		Return IsVisible(rc.X, rc.Y, rc.Width, rc.Height)
-	End Function
-
-	Const Function IsVisible(x As Single, y As Single) As BOOL
+		IsVisible = b As Boolean
+	End Function
+
+	Const Function IsVisible(ByRef rc As Rectangle) As Boolean
+		IsVisible = IsVisible(rc.X, rc.Y, rc.Width, rc.Height)
+	End Function
+
+	Const Function IsVisible(x As Single, y As Single) As Boolean
 		Dim b = FALSE As BOOL
 		SetStatus(GdipIsVisiblePoint(nativeGraphics, x, y, b))
-		Return b
-	End Function
-
-	Const Function IsVisible(point As /*Const*/ PointF) As BOOL
-		Return IsVisible(pt.X, pt.Y)
-	End Function
-
-	Const Function IsVisible(x As Single, y As Single, width As Single, height As Single) As BOOL
+		IsVisible = b As Boolean
+	End Function
+
+	Const Function IsVisible(ByRef pt As PointF) As Boolean
+		IsVisible = IsVisible(pt.X, pt.Y)
+	End Function
+
+	Const Function IsVisible(x As Single, y As Single, width As Single, height As Single) As Boolean
 		Dim b = FALSE As BOOL
 		SetStatus(GdipIsVisibleRect(nativeGraphics, x, y, width, height, b))
-		Return b
-	End Function
-
-	Const Function IsVisible(rect As /*Const*/ RectangleF) As BOOL
-		Return IsVisible(rc.X, rc.Y, rc.Width, rc.Height)
-	End Function
-
-	Const Function Save() As GraphicsState
-		Dim gstate As GraphicsState
-		SetStatus(GdipSaveGraphics(nativeGraphics, state))
-		Return gstate
-	End Function
-
-	Function Restore(gstate As GraphicsState)
-		Return SetStatus(GdipRestoreGraphics(nativeGraphics, gstate))
-	End Function
-
-	Function BeginContainer(dstrect As /*Const*/ RectangleF, srcrect As /*Const*/ RectangleF, unit As GraphicsUnit) As GraphicsContainer
-		Dim state As GraphicsContainer
-		SetStatus(GdipBeginContainer(nativeGraphics, dstrect, srcrect, unit, state))
-		Return state
-	End Function
-
-	Function BeginContainer(dstrect As /*Const*/ Rectangle, srcrect As /*Const*/ Rectangle, unit As GraphicsUnit) As GraphicsContainer
-		Dim state As GraphicsContainer
-		SetStatus(GdipBeginContainerI(nativeGraphics, dstrect, srcrect, unit, state))
-		Return state
-	End Function
-
-	Function BeginContainer() As GraphicsContainer
-		Dim state As GraphicsContainer
-		SetStatus(GdipBeginContainer2(nativeGraphics, state))
-		Return state
-	End Function
-
-	Function EndContainer(state As GraphicsContainer) As Status
-		Return SetStatus(GdipEndContainer(nativeGraphics, state))
-	End Function
-
-	' Only valid when recording metafiles.
-
-	Function AddMetafileComment(data As /*Const*/ *Byte, sizeData As DWord)
-		Return SetStatus(GdipComment(nativeGraphics, sizeData, data))
-	End Function
+		IsVisible = b As Boolean
+	End Function
+
+	Const Function IsVisible(ByRef rc As RectangleF) As Boolean
+		IsVisible = IsVisible(rc.X, rc.Y, rc.Width, rc.Height)
+	End Function
+
+	Const Function Save() As Drawing2D.GraphicsState
+		SetStatus(GdipSaveGraphics(nativeGraphics, Save))
+	End Function
+
+	Sub Restore(gstate As Drawing2D.GraphicsState)
+		SetStatus(GdipRestoreGraphics(nativeGraphics, gstate))
+	End Sub
+
+	Function BeginContainer(ByRef dstrect As RectangleF, ByRef srcrect As RectangleF, unit As GraphicsUnit) As Drawing2D.GraphicsContainer
+		SetStatus(GdipBeginContainer(nativeGraphics, dstrect, srcrect, unit, BeginContainer))
+	End Function
+
+	Function BeginContainer(ByRef dstrect As Rectangle, ByRef srcrect As Rectangle, unit As GraphicsUnit) As Drawing2D.GraphicsContainer
+		SetStatus(GdipBeginContainerI(nativeGraphics, dstrect, srcrect, unit, BeginContainer))
+	End Function
+
+	Function BeginContainer() As Drawing2D.GraphicsContainer
+		SetStatus(GdipBeginContainer2(nativeGraphics, BeginContainer))
+	End Function
+
+	Sub EndContainer(state As Drawing2D.GraphicsContainer)
+		SetStatus(GdipEndContainer(nativeGraphics, state))
+	End Sub
+
+	Sub AddMetafileComment(data As *Byte, sizeData As DWord)
+		SetStatus(GdipComment(nativeGraphics, sizeData, data))
+	End Sub
 
 	Static Function GetHalftonePalette() As HPALETTE
-		Return GdipCreateHalftonePalette()
-	End Function
-
-	Const Function GetLastStatus() As Status
-		Dim lastStatus = lastResult
-		lastResult = Status.Ok
-		Return lastStatus
-	End Function
+		GdipCreateHalftonePalette()
+	End Function
+
+	Function NativeGraphics() As *GpGraphics
+		NativeGraphics = nativeGraphics
+	End Function
+
+	Sub Graphics(graphics As *GpGraphics)
+		nativeGraphics = graphics
+	End Sub
 
 Private
-'	Sub Graphics(gr As Graphics)
-'		Debug
-'	End Sub
-	Sub Operator =(gr As Graphics)
-		Debug
-	End Sub
-
-Protected
-	Sub Graphics(graphics As *GpGraphics)
-		lastResult = Status.Ok
-		SetNativeGraphics(graphics)
-	End Sub
-
-	Sub SetNativeGraphics(graphics As *GpGraphics)
-		This.nativeGraphics = graphics
-	End Sub
-
-	Const Function SetStatus(status As Status) As Status
-		If status <> Status.Ok Then
-			lastResult = status
+	Static Function getNativePen(pen As Pen) As *GpPen
+		If ActiveBasic.IsNothing(pen) Then
+			getNativePen = 0
+		Else
+			getNativePen = pen.NativePen
 		End If
-		Return status
-	End Function
-
-	Const Function GetNativeGraphics() As *GpGraphics
-		Return This.nativeGraphics
-	End Function
-
-	Function GetNativePen(pen As /*Const*/ *Pen) As *GpPen
-		Return pen->nativePen
-	End Function
-
-Protected
+	End Function
+
+	Static Function getNativeStringFormat(sf As StringFormat) As *GpStringFormat
+		If ActiveBasic.IsNothing(sf) Then
+			getNativeStringFormat = 0
+		Else
+			getNativeStringFormat = sf.nativeFormat
+		End If
+	End Function
+
+	Static Function getNativeBrush(br As Brush) As *GpBrush
+		If ActiveBasic.IsNothing(br) Then
+			getNativeBrush = 0
+		Else
+			getNativeBrush = br.nativeBrush
+		End If
+	End Function
+
+	Static Function getNativeFont(font As Font) As *GpFont
+		If ActiveBasic.IsNothing(font) Then
+			getNativeFont = 0
+		Else
+			getNativeFont = font.NativeFont
+		End If
+	End Function
+
+	Static Function getNativeImage(image As Image) As *GpImage
+		If ActiveBasic.IsNothing(image) Then
+			getNativeImage = 0
+		Else
+			getNativeImage = image.nativeImage
+		End If
+	End Function
+
+	Static Function getNativeImageAttributes(imageAttr As ImageAttributes) As *GpImageAttributes
+		If ActiveBasic.IsNothing(imageAttr) Then
+			getNativeImageAttributes = 0
+		Else
+			getNativeImageAttributes = imageAttr.nativeImage
+		End If
+	End Function
+
 	nativeGraphics As *GpGraphics
-	lastResult As /*Mutable*/ Status
 End Class
 
