How to use a separate .cpp file for my event function definitions in windows forms?

烈酒焚心 提交于 2019-12-04 16:24:10

Your class definition is most likely inside of some namespace (I'll use Project1 as a placeholder):

#pragma once

namespace Project1
{
    ref class Form1 : public System::Windows::Forms::Form
    {
        // ...
    };
}

Consequently, your definition needs to be as well:

#include "Form1.h"

namespace Project1
{
    void Form1::ganttBar1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e)
    {
        // definition
    }
}

or

#include "Form1.h"

void Project1::Form1::ganttBar1_Paint(System::Object^ sender, System::Windows::Forms::PaintEventArgs^ e)
{
    // definition
}
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!