System::Drawing::Point is a struct, not a class. Structs are value types, and don't need the new operator. I'm not at a compiler, but I believe this is the syntax you want:
Point p(100, 100);
panel1->AutoScrollPosition = p;
(Also, Point being a managed type, gcnew
would be much more appropriate. new
works, but is very nonstandard, no APIs will accept a parameter of that type.)
The other thing you tried:
panel1->AutoScrollPosition.X = 100;
panel1->AutoScrollPosition.Y = 100;
That doesn't work because Point is a struct. AutoScrollPosition
returns a COPY of the struct, and that's what you modified. C# will give a compiler warning when you try this. If you do need to modify one component of a Point, here's what you need to do (this applies to both C++/CLI and C#):
Point p = panel1->AutoScrollPosition;
p.X = 100;
panel1->AutoScrollPosition = p;