GDI+ New Matrix() generates Out Of Mem Exception

G

Guest

The following code, copied from MSDN article "Using Matrix Transformation in
System.Drawing" creates an OutOfMemoryException when creating the Matrix.

The downloaded MSDN source code works fine.

Any ideas please? Thanks a lot!
Herbert


Imports System.Drawing.Drawing2D

Public Class Form1
Inherits System.Windows.Forms.Form

'define the application coordinate range
Private mMinX As Double = -5.0
Private mMaxX As Double = -5.0
Private mMinY As Double = mMinX
Private mMaxY As Double = mMaxX

#Region " Vom Windows Form Designer generierter Code "

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

'create the transformation axis using a rectangle (sized in
application coordinates) and
'three points in device coordinates (pixels).
Dim rectPlotF = New RectangleF _
(mMinX, mMaxY, (mMaxX - mMinX), -(mMaxY - mMinY))

Dim bmpcorners(2) As PointF
bmpcorners(0) = New PointF(0, 0)
bmpcorners(1) = New PointF(Me.Width, 0)
bmpcorners(2) = New PointF(0, Me.Height)

' the graphic object will now implicitly convert (x,y)
' to pixel coordinates
Dim mTransform As Matrix
mTransform = New Matrix(rectPlotF, bmpcorners) 'create
transformation matrix

End Sub
End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top