尝试从另一个.cpp启动TShape时,成员标识符应出现错误

Member identifier expected error when trying to initiate a TShape from another .cpp

本文关键字:标识符 成员 错误 另一个 cpp TShape 启动      更新时间:2023-10-16

因此,我试图在派生文件中创建并初始化一个TShape对象,并获得预期的E2280成员标识符。这是代码

#include "Data.h"
#include "MainWindow.h"
#include <vcl.h>
class item{
public:
    TShape *Forma;
    TImage *Imagine;
    TLabel *Denumire, *Set, *Stat, *Price, *Weight, *Effect, *Type, *ID;
    TButton *Equip;
    item(int k);
};
item::item(int k){
    int pozitia_forma=k*130+5;
    Forma->new TShape(MainWindow_Form);
    Forma->Parent=MainWindow_Form->ScrollBox;
    Forma->Height=130;
    Forma->Width=370;
    Forma->Top=pozitia_forma;
    Forma->Left=5;
}

此语法错误:

Forma->new TShape(MainWindow_Form);

看起来你需要

Forma = new TShape(MainWindow_Form);