Cunctator

Hi, i'va a little strange proble
Code Snippet

m during compiling my visual c++ express project...
I'm trying to use the e->graphic->drawlines(pen,point[]) function.
I used to allocate an array old way, i explain: if i want to allocate an array of Point, i write:

Code Snippet

Point MyPointArray[100];


or, if i would to create a pointer toro an array, i should write:
Code Snippet

Point *MyPointArrayPt; MyPointArrayPt = new Point[100];


Now, i learned i've to write:
Code Snippet

Point ^MyPointArrayPt; MyPointArrayPt = gcnew Point[100];


then, use the
Code Snippet

e->Graphics->DrawLines(MyPen,MyPointArrayPt)

func, but it still don't works, and get to me the "error C2728 - 'type' : a native array cannot contain this managed type"
So i've surfed a little the web and discovered the "new way" in array declaration:
Code Snippet

array< Point^,1>^ MyPointArrayPt = gcnew array< Point^,1>(100);


And, surprise, it works... but if i try to use the
Code Snippet

e->Graphics->DrawLines(MyPen,MyPointArrayPt);

i get the
Code Snippet

Code Snippet

error C2664: 'void System::Drawing::Graphics::DrawLines(System::Drawing::Pen ^,cli::array<Type,dimension> ^)': impossible to converte parameter 2 from'cli::array<Type,dimension> ^' to 'cli::array<Type,dimension> ^'.



Now, is particular that it can't converts array<Type,dimension> ^ to array<Type,dimension> ^, because they are the same thing.
Can someone tell me why and how to solve this problem
Tnx to all in Microsoft and to all who surf this forum anyway.



Re: Visual C++ Express Edition Problem with System::drawing::point allocation...

nobugz

System:: Drawing:: Point is a "struct", not a class. You don't use the "hat" with a valuetype. The correct usage is:

array<Point>^ MyPointArrayPt = gcnew array<Point>(100);
...
e->Graphics->DrawLines(Pens:: Black, MyPointArrayPt);






Re: Visual C++ Express Edition Problem with System::drawing::point allocation...

Cunctator

THANKS A LOT MAN!

In the world shold be much more people like you!!

Thanks!!!!