C ++ Builder TImage OnClick事件

时间:2018-12-05 14:58:26

标签: c++ c++builder

我正在C ++ Builder中从事记忆游戏。为此,我对图像进行了动态分配,例如:

int nr=1;
(int i=0; i<4; i++)
{
    for(int j = 0; j < 8 ; j++)
    {
        int idx=i*8+j;
        VectorOfImages[idx]=new Card(9+i*112,9+j*112,pan, nr);
        VectorOfImages[idx]->image->Picture->LoadFromFile("D:\\proiect OOP\\c builder\\AppClient\\images\\0.bmp");
        VectorOfImages[idx]->image->Tag=idx;
        VectorOfImages[idx]->image->Enabled=false;
        //VectorOfImages[idx]->image->OnClick=&ImageClicked ;
        nr++;
    }
}

但是该程序永远不会进入“ ImageClicked”功能。

Card::Card(int x0,int y0,TPanel *p, int nr):Position(x0,y0)
{
    image= new TImage(p);
    image->Parent=p;
    image->Show();
    image->Cursor=crHandPoint;
    image->Top=x0;
    image->Left=y0;
    imageNr=nr;
    image->OnClick = pp->ImageClick;
}

请帮助。

0 个答案:

没有答案