void __fastcall TForm_MeasureInfo::makeStringGrid()
{
// // Title Cell
StringGrid1->Cells[0][0] = "";
StringGrid1->ColWidths[0] = 40;
//
cbTitleCell = new TCheckBox(this);
StringGrid1->Objects[0][0] = cbTitleCell;
cbTitleCell->Parent = StringGrid1;
cbTitleCell->BoundsRect = StringGrid1->CellRect(0,0);
cbTitleCell->Name = "cbTitleCell";
cbTitleCell->Caption = "Cell";
cbTitleCell->OnMouseUp = CheckBoxMouseUp;
cbTitleCell->OnClick = CheckBoxClick;
cbTitleCell->Visible = true;
//
// // HEADER Title
StringGrid1->Cells[1][0] = "Initial I [µA]";
StringGrid1->ColWidths[1] = 110;
StringGrid1->Cells[2][0] = "Output R [Ω]";
StringGrid1->ColWidths[2] = 110;
StringGrid1->Cells[3][0] = "OCP [µA]";
StringGrid1->ColWidths[3] = 110;
StringGrid1->Cells[4][0] = "OVP [V]";
StringGrid1->ColWidths[4] = 110;
for(int i = 1; i < StringGrid1->RowCount; i++)
{
StringGrid1->Cells[0][i] = IntToStr(i);
Cell
cbCell[i - 1] = new TCheckBox(StringGrid1);
StringGrid1->Objects[0][i] = cbCell[i - 1];
cbCell[i - 1]->Parent = StringGrid1;
cbCell[i - 1]->BoundsRect = StringGrid1->CellRect(0, i);
cbCell[i - 1]->Name = "cbCell" + FormatFloat("00", i);
cbCell[i - 1]->Caption = "";
cbCell[i - 1]->Tag = i;
cbCell[i - 1]->OnMouseUp = CheckBoxMouseUp;
//
// Initial I
editInitI[i - 1] = new TEdit(StringGrid1);
StringGrid1->Objects[1][i] = editInitI[i - 1];
editInitI[i - 1]->Parent = StringGrid1;
editInitI[i - 1]->BoundsRect = StringGrid1->CellRect(1, i);
editInitI[i - 1]->Name = "editInitI" + FormatFloat("00", i);
editInitI[i - 1]->Text = "";
// Output R
editOutputR[i - 1] = new TEdit(StringGrid1);
StringGrid1->Objects[2][i] = editOutputR[i - 1];
editOutputR[i - 1]->Parent = StringGrid1;
editOutputR[i - 1]->BoundsRect = StringGrid1->CellRect(2, i);
editOutputR[i - 1]->Name = "editOutputR" + FormatFloat("00", i);
editOutputR[i - 1]->Text = "";
// OCP
editOCP[i - 1] = new TEdit(StringGrid1);
StringGrid1->Objects[3][i] = editOCP[i - 1];
editOCP[i - 1]->Parent = StringGrid1;
editOCP[i - 1]->BoundsRect = StringGrid1->CellRect(3, i);
editOCP[i - 1]->Name = "editOCP" + FormatFloat("00", i);
editOCP[i - 1]->Text = "";
// OVP
editOVP[i - 1] = new TEdit(StringGrid1);
StringGrid1->Objects[4][i] = editOVP[i - 1];
editOVP[i - 1]->Parent = StringGrid1;
editOVP[i - 1]->BoundsRect = StringGrid1->CellRect(4, i);
editOVP[i - 1]->Name = "editOVP" + FormatFloat("00", i);
editOVP[i - 1]->Text = "";
}
}
void __fastcall TForm_MeasureInfo::StringGrid1DrawCell(TObject *Sender, int ACol,
int ARow, TRect &Rect, TGridDrawState State)
{
if(ARow == 0)
{
StringGrid1->Canvas->Brush->Color = clSilver;
StringGrid1->Canvas->FillRect(Rect);
StringGrid1->Font->Style = TFontStyles() << fsBold;
}
}
{
// // Title Cell
StringGrid1->Cells[0][0] = "";
StringGrid1->ColWidths[0] = 40;
//
cbTitleCell = new TCheckBox(this);
StringGrid1->Objects[0][0] = cbTitleCell;
cbTitleCell->Parent = StringGrid1;
cbTitleCell->BoundsRect = StringGrid1->CellRect(0,0);
cbTitleCell->Name = "cbTitleCell";
cbTitleCell->Caption = "Cell";
cbTitleCell->OnMouseUp = CheckBoxMouseUp;
cbTitleCell->OnClick = CheckBoxClick;
cbTitleCell->Visible = true;
//
// // HEADER Title
StringGrid1->Cells[1][0] = "Initial I [µA]";
StringGrid1->ColWidths[1] = 110;
StringGrid1->Cells[2][0] = "Output R [Ω]";
StringGrid1->ColWidths[2] = 110;
StringGrid1->Cells[3][0] = "OCP [µA]";
StringGrid1->ColWidths[3] = 110;
StringGrid1->Cells[4][0] = "OVP [V]";
StringGrid1->ColWidths[4] = 110;
for(int i = 1; i < StringGrid1->RowCount; i++)
{
StringGrid1->Cells[0][i] = IntToStr(i);
Cell
cbCell[i - 1] = new TCheckBox(StringGrid1);
StringGrid1->Objects[0][i] = cbCell[i - 1];
cbCell[i - 1]->Parent = StringGrid1;
cbCell[i - 1]->BoundsRect = StringGrid1->CellRect(0, i);
cbCell[i - 1]->Name = "cbCell" + FormatFloat("00", i);
cbCell[i - 1]->Caption = "";
cbCell[i - 1]->Tag = i;
cbCell[i - 1]->OnMouseUp = CheckBoxMouseUp;
//
// Initial I
editInitI[i - 1] = new TEdit(StringGrid1);
StringGrid1->Objects[1][i] = editInitI[i - 1];
editInitI[i - 1]->Parent = StringGrid1;
editInitI[i - 1]->BoundsRect = StringGrid1->CellRect(1, i);
editInitI[i - 1]->Name = "editInitI" + FormatFloat("00", i);
editInitI[i - 1]->Text = "";
// Output R
editOutputR[i - 1] = new TEdit(StringGrid1);
StringGrid1->Objects[2][i] = editOutputR[i - 1];
editOutputR[i - 1]->Parent = StringGrid1;
editOutputR[i - 1]->BoundsRect = StringGrid1->CellRect(2, i);
editOutputR[i - 1]->Name = "editOutputR" + FormatFloat("00", i);
editOutputR[i - 1]->Text = "";
// OCP
editOCP[i - 1] = new TEdit(StringGrid1);
StringGrid1->Objects[3][i] = editOCP[i - 1];
editOCP[i - 1]->Parent = StringGrid1;
editOCP[i - 1]->BoundsRect = StringGrid1->CellRect(3, i);
editOCP[i - 1]->Name = "editOCP" + FormatFloat("00", i);
editOCP[i - 1]->Text = "";
// OVP
editOVP[i - 1] = new TEdit(StringGrid1);
StringGrid1->Objects[4][i] = editOVP[i - 1];
editOVP[i - 1]->Parent = StringGrid1;
editOVP[i - 1]->BoundsRect = StringGrid1->CellRect(4, i);
editOVP[i - 1]->Name = "editOVP" + FormatFloat("00", i);
editOVP[i - 1]->Text = "";
}
}
void __fastcall TForm_MeasureInfo::StringGrid1DrawCell(TObject *Sender, int ACol,
int ARow, TRect &Rect, TGridDrawState State)
{
if(ARow == 0)
{
StringGrid1->Canvas->Brush->Color = clSilver;
StringGrid1->Canvas->FillRect(Rect);
StringGrid1->Font->Style = TFontStyles() << fsBold;
}
}
댓글