0

以下のプログラムでは、次のエラーが発生します。

error C2143: syntax error : missing ';' before '->'  
error C2143: syntax error : missing ';' before '->' 

私がどこで間違っていると思いますか?

#include "stdafx.h"
#include <stdio.h>
#using <system.drawing.dll>
using namespace System;
using namespace System::Drawing;
int main()
{       
Image^ newImage = Image::FromFile( "SampImag.jpg" );
// Create parallelogram for drawing image.
Point ulCorner = Point(100,100);
Point urCorner = Point(325,100);
Point llCorner = Point(150,250);
array<Point>^ destPara = {ulCorner,urCorner,llCorner};
// Create rectangle for source image.
Rectangle srcRect = Rectangle(50,50,150,150);
GraphicsUnit units = GraphicsUnit::Pixel;
// Draw image to screen.
    //Graphics1 = new Graphics();  
     Graphics->DrawImage( newImage, destPara, srcRect, units );
   return 0;
 }
4

1 に答える 1

0

問題は、GraphicsクラスのインスタンスでのみDrawImageを呼び出すことができることです。

ただし、問題は、Graphicsクラスが抽象クラスであり、コンソールアプリケーションに関連付けられたGraphicsオブジェクトがないことです。このMSDNの記事では、Graphicsクラスの使用方法に関する情報を提供しています。まず、Graphicsクラスを使用して動作するC#コンソールアプリを作成してから、C ++/CLIに変換します。これは、この問題に取り組むためのより簡単な方法です。

許可されている場合は、VS2012を使用してC++ / CLIアプリケーションを作成してみてください。これは、C ++/CLIプロジェクトにインテリセンスを提供するためです。

于 2012-11-11T05:33:39.053 に答える