constructor of an array of Point

Hello,

I want to make a matrix like this:

System::Drawing::Drawing2D::Matrix^ L;
L=gcnew( System::Drawing::Drawing2D::Matrix::Matrix(rect,plgpts));

rect works properly but not plgpts
plgpts is an array of Points.
So I make that:

cli::array<System::Drawing::Point>^ plgpts;
plgpts=gcnew(cli::array<System::Drawing::Point, 3>);

and I have this errors:

Error C3149: 'cli::array<Type,dimension>' : cannot use this type here without a top-level '^'
Error C2748: managed array creation must have array size or array initializer

I don't know how to solve them.
Could anyone of you help me??

Thank you in advanced!
The first is simple to solve - you cannot have an array of Point, you need to have an arry of handles to Point, so you need
 
cli::array<System::Drawing::Point^>^ plgpts;

The second may be simple or not, depending on how your application is designed to behave.
managed arrays need to have the array bounds set when created
EG
array<int>^ myArray = gcnew array<int>(5); //Arry with 5 elements
or
plgpts=gcnew(cli::array<System::Drawing::Point^, 3>(5,10,20)); //3D Array 5x10x20
closed account (z05DSL3A)
As I recall the Matrix constructor you are calling takes a Rectangle and an array of three pointers, somthing like this should work:

1
2
3
4
5
6
7
    Rectangle rect(0,0,100,100);

    cli::array<Point>^ plgpts = gcnew cli::array<Point>(3);
    //
    // Set the points in the array here
    //
    Matrix^ L = gcnew Matrix(rect,plgpts);
Last edited on
Topic archived. No new replies allowed.