我是 C++ Builder 的新手,真的需要一些帮助。在我的工作中,我们必须使用 C++ Builder,但我找不到太多关于它的文档。
我想要做的是在每次用户按下Insert键时在每列中插入一个包含一些数据的新行。我的 TGrid 总共有 20 行:1TCheckColumn
和 19TStringColumn
。
我不知道该怎么做。首先,这是我在有人输入插入键时已经编写的代码:
void __fastcall TForm2::Grid1KeyDown(TObject *Sender, WORD &Key, System::WideChar &KeyChar,
TShiftState Shift)
{
switch(Key)
{
case VK_INSERT:
if(Grid1->RowCount>MAXTask){}else
{
Label1->Text = "number Task: "+IntToStr(++nmbertask);
Grid1->RowCount++;
}
break;
}
}
这是Grid1GetValue()
和Grid1SetValue()
代码:
void __fastcall TForm2::Grid1GetValue(TObject *Sender, const int Col, const int Row,
TValue &Value)
{
switch(Col)
{
case 0:
Value = A[Col][Row]; break;
case 1:
Value = A[Col][Row]; break;
case 2:
Value = A[Col][Row]; break;
case 3:
Value = A[Col][Row]; break;
case 4:
Value = A[Col][Row]; break;
case 5:
Value = A[Col][Row]; break;
case 6:
Value = A[Col][Row]; break;
case 7:
Value = A[Col][Row]; break;
case 8:
Value = A[Col][Row]; break;
case 9:
Value = A[Col][Row];break;
case 10:
Value = A[Col][Row];break;
case 11:
Value = A[Col][Row];break;
case 12:
Value = A[Col][Row];break;
case 13:
Value = A[Col][Row];break;
case 14:
Value = A[Col][Row];break;
case 15:
Value = A[Col][Row];break;
case 16:
Value = A[Col][Row];break;
case 17:
Value = A[Col][Row];break;
case 18:
Value = A[Col][Row]; break;
case 19:
Value = A[Col][Row];break;
}
}
void __fastcall TForm2::Grid1SetValue(TObject *Sender, const int Col, const int Row,
const TValue &Value)
{
switch(Col)
{
case 0:
A[Col][Row] = Value; break;
case 1:
A[Col][Row] = Value; break;
case 2:
A[Col][Row] = Value; break;
case 3:
A[Col][Row] = Value; break;
case 4:
A[Col][Row] = Value; break;
case 5:
A[Col][Row] = Value; break;
case 6:
A[Col][Row] = Value; break;
case 7:
A[Col][Row] = Value; break;
case 8:
A[Col][Row] = Value; break;
case 9:
A[Col][Row] = Value; break;
case 10:
A[Col][Row] = Value; break;
case 11:
A[Col][Row] = Value; break;
case 12:
A[Col][Row] = Value; break;
case 13:
A[Col][Row] = Value; break;
case 14:
A[Col][Row] = Value; break;
case 15:
A[Col][Row] = Value; break;
case 16:
A[Col][Row] = Value; break;
case 17:
A[Col][Row] = Value; break;
case 18:
A[Col][Row] = Value; break;
case 19:
A[Col][Row] = Value; break;
}
}
这是我到目前为止所做的。我从来没有在 C++ Builder 中开发过,你能帮帮我吗?我并不是真的在寻找书面解决方案,我真的在寻找在哪里寻找解决方案的指示。
如果我不清楚,请指出,以便我提供更多信息。如果你也有一个很好的网站,里面有关于 C++ Builder 的很好的文档,请告诉我。英语不是我的母语,但我会尽力而为。