이벤트 추가 이벤트 추가는 위임(http://petra.tistory.com/1175)과 이벤트(http://petra.tistory.com/1178) 참조 이벤트 처리할 함수(51행)는 외부에서 호출되면 안되므로 private 로 지정하며 이벤트가 발생한 객체(컨트롤)의 포인터와 이벤트 정보는 갖는 EventArgs 포인터를 인수로 지정한다. 마지막으로, 34행처럼 클릭 이벤트에 이벤트 핸들러 인수로 Btn1_Clicked 를 지정하면 등록된다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 5..
버튼 추가 폼에 버튼 추가하려면 버튼의 위치(Point)와 크기(Size)를 설정하기 위해 System::Drawing 이 필요해서 3, 8행을 추가한다. CppForm 클래스의 생성자에서 버튼을 만들고 속성(텍스트, 크기, 위치)을 지정하는 Setup_Buttons() 을 만든다. 20, 21행의 Controls 속성은 현재 폼에 추가된 모든 컨트롤들에 대한 참조를 가지므로, 버튼을 추가해줘야 화면에서 보여진다. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 #using #using #using using namespace System; us..
윈도우즈 폼 윈도우즈 폼 프로그램의 기본 코드> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 #using #using using namespace System; using namespace System::ComponentModel; using namespace System::Windows::Forms; public ref class CppForm : public Form { public: CppForm() {}; }; int main(array ^args) { Application::Run(gcnew CppForm()); return 0; } Colored by Color Scripter cs 1, 2행 : 윈도우즈 폼을 생성할때 필요한 어셈블리를 포함하고 있다. 5행..
// ConsoleApplication1.cpp : 기본 프로젝트 파일입니다. #include "stdafx.h" #using #using using namespace System; using namespace System::ComponentModel; using namespace System::Windows::Forms; public delegate void FirstEventHandler(String^); public delegate void SecondEventHandler(String^); public delegate double NumericOp(double); ref class Ops { public: event FirstEventHandler^ OnFirstEvent; event Second..