기본 콘텐츠로 건너뛰기

C++ - StringGrid 에 checkbox, textbox 넣기

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;
}
}

댓글

이 블로그의 인기 게시물

C# - Serial Port ASCII/HEX Format

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.IO.Ports; namespace SerialTest1 {     public partial class Form1 : Form     {         delegate void MyDelegate();      //델리게이트 선언(크로스 쓰레드 해결하기 위한 용도)         bool SendForamt = true;          // true : ASCII   false : HEX         bool ReceiveFormat = true;       // true : ASCII   false : HEX         public Form1()         {             InitializeComponent();          ...

C# - Windows Form 에 있는 control 찾기

// 아래 코드는 form 의 최상위 control만 찾을 수 있음. // panle, groubbox ... 내부에 있는 control은 찾지 못함. Control GetControlByName(string Name) {     foreach (Control c in this.Controls)         if (c.Name == Name)             return c;     return null; } // form 의 모든 control을 찾을 수 있음. string name = "btnBit" + (i + 1).ToString("D2"); var tmpBtn = this.Controls.Find(name, true).FirstOrDefault(); if (tmpBtn != null) {     if (value == 1) tmpBtn.BackColor = Color.Lime;     else tmpBtn.BackColor = Color.Gray; }

C# - ARGB 색상

속성 A 이  Color  구조체의 알파 구성 요소 값을 가져옵니다. Alice Blue ARGB 값이  #FFF0F8FF 인 시스템 정의 색을 가져옵니다. Antique White ARGB 값이  #FFFAEBD7 인 시스템 정의 색을 가져옵니다. Aqua ARGB 값이  #FF00FFFF 인 시스템 정의 색을 가져옵니다. Aquamarine ARGB 값이  #FF7FFFD4 인 시스템 정의 색을 가져옵니다. Azure ARGB 값이  #FFF0FFFF 인 시스템 정의 색을 가져옵니다. B 이  Color  구조체의 파랑 구성 요소 값을 가져옵니다. Beige ARGB 값이  #FFF5F5DC 인 시스템 정의 색을 가져옵니다. Bisque ARGB 값이  #FFFFE4C4 인 시스템 정의 색을 가져옵니다. Black ARGB 값이  #FF000000 인 시스템 정의 색을 가져옵니다. Blanched Almond ARGB 값이  #FFFFEBCD 인 시스템 정의 색을 가져옵니다. Blue ARGB 값이  #FF0000FF 인 시스템 정의 색을 가져옵니다. Blue Violet ARGB 값이  #FF8A2BE2 인 시스템 정의 색을 가져옵니다. Brown ARGB 값이  #FFA52A2A 인 시스템 정의 색을 가져옵니다. Burly Wood ARGB 값이  #FFDEB887 인 시스템 정의 색을 가져옵니다. Cadet Blue ARGB 값이  #FF5F9EA0 인 시스템 정의 색을 가져옵니다. Chartreuse ARGB 값이  #FF7FFF00 인 시스템 정의 색을 가져옵니다. Chocolate ARGB 값이  #FFD2691E 인 시스템 정의 색을 가져옵니다. Coral ARGB ...