/*★ OnPaint override する 前田 稔 ★*/ #using #using #using using namespace System; using namespace System::Windows::Forms; using namespace System::Drawing; //フォームを作成するクラス ref class FormClass : public System::Windows::Forms::Form { private: public: //Constructor FormClass() { } virtual void OnPaint(PaintEventArgs ^e) override { Graphics^ g = e->Graphics; g->DrawLine(gcnew Pen(Color::Red),10,50,260,50); g->DrawLine(gcnew Pen(Color::Green,10),10,150,260,150); } }; //★ main() 関数 int main() { // メイン ウィンドウを作成して、実行します Application::Run(gcnew FormClass()); return 0; }