±ÍÇÏ´Â ¼Õ´Ô À̽ʴϴÙ
·Î±×ÀÎ
ȸ¿ø°¡ÀÔ
  
  µ¨¸¶´ç °ø½Ä ÀºÇà°èÁÂ
  ÇϳªÀºÇà 227-910235-83607
  ¿¹±ÝÁÖ ÀÌ»ó±¹(¿î¿µÁø)
ÇÁ·ÎÁ§Æ® °Ô½ÃÆÇ
ÅõÇ¥°Ô½ÃÆÇ
µ¨¸¶´ç¼Ò°³
±âÃʺÎÅÍ È°¿ë±îÁö! µ¨ÆÄÀÌ ±³À° - µ¥ºê±â¾î
Áú¹®°ú ´äº¯ Áú¹®°ú ´äº¯ ÀÔ´Ï´Ù.
±Û³»¿ë - Áú¹®°ú ´äº¯
 [Áú¹®] StringGrid Ãâ·Â¿¡ °üÇÑ Áú¹®
entrophy
(Á¤°æ¿ø)
2017-08-12 ¿ÀÈÄ 12:10:33
611ȸ Á¶È¸


µî·ÏµÈ ÆÄÀÏÀÌ ¾ø½À´Ï´Ù.
1. °³¹ß/½ÇÇà Ç÷§Æû 
  (1) OS : win10 32
  (2) °³¹ßÅø : delphi Rad Studio 10.1
  (3) »ç¿ë Database : N/A

2. °³¹ß ÁßÀΠÇÁ·Î±×·¥ 
   Testing Áß 

¾È³çÇϼ¼¿ä.¼±¹è´ÔµéÀÇ °í°ßÀ» µè°í ½Í½À´Ï´Ù.
¾Æ¹«·¡µµ Ãë¹Ì·Î Çϴ ¼öÁØÀ̶󠸹ÀÌ ºÎÁ·Çؼ­¿ä ¤Ð¤Ð

Áú¹®1) stringgrid ¿¡ ±ÛÀ» Ãâ·Â ÇÒ¶§ Performance °¡ ¶Ù¾î³­ ¹æ¹ýÀÌ ¾î¶²°ÍÀÌ ÀÖÀ»±î¿ä?

Type
  Tstudent = record
    name : string;
    number : integer;
    height : integer;
    weight : integer;
  end;

  private
  student : Tlist<Tstudent> //generics.collections uses

  TForm1 = class(TForm)
    StringGrid: TStringGrid;
    procedure FormCreate(Sender: TObject);

Implementation

procedure TForm1.FormCreate(Sender: TObject);
begin
  student := Tlist<Tstudent>.create;
end

ÀÌ·±½ÄÀ¸·Î student ¶ó´Â ±¸Á¶Ã¼¸¦ ¸¸µé¾î¼­ StringGrid¿¡ ³»¿ëÀ» »Ñ·ÁÁÝ´Ï´Ù.

ÇлýÀÇ ¼ö°¡ 10¸¸¸íÀÌ»óÀÌ µÉ ¼ö ÀÖÀ¸¸ç, ½Ç½Ã°£À¸·Î ÇлýÀÇ ¼ö°¡ Áٱ⵵ ´Ã¾î³ª±âµµ ÇÏ°í,
°¢ ÇлýµéÀÇ height °ªµµ º¯°æ µÇ±âµµ Çϴµ¥ ÀÌ·¯ÇÑ »óȲ¼Ó¿¡¼­ 
StringGrid ÀÇ ÇϳªÀÇ ¿­¿¡ height °ªÀ» »Ñ·Á ÁÖ·Á°í ÇÕ´Ï´Ù. 
(½Ç½Ã°£À¸·Î º¯°æ µÇ´Â ³»¿ëÀÌ StringGrid È­¸é¿¡¼­ ¹Ý¿µµÇ¾î º¯°æ µÇ¾î¾ß ÇÕ´Ï´Ù)


Àú´Â ´Ü¼øÈ÷ °ªÀÇ º¯È­³ª Çлý ¼ö°¡ ´Ã°í ÁÙÀ» ¶§ ¸¶´Ù loop ¸¦ µ¹·Á¼­ ¾Æ·¡¿Í °°ÀÌ ²Ù¹Ì·Á°í ÇÕ´Ï´Ù.

stringGrid.cols[0].beginupdate;
for i := 0 to student.count-1
begin
  stringGrid.cell[0,i] := IntToStr(student.list[i].student.height);
end
stringGrid.cols[0].endupdate;

ÀÌ·¸°Ô ²Ù¹Ì·Á°í Çϴµ¥ ´õ ÁÁÀº ¹æ¹ýÀÌ ÀÖÀ»±î¿ä? 
º¯¼öÀÇ ±¸Á¶°¡ ´Þ¶óÁ®µµ »ó°ü ¾ø½À´Ï´Ù.



Áú¹®2) beginupdate ¹× endupdate ¿¡ ´ëÇÑ ³»¿ëÀÔ´Ï´Ù. 

stringGrid.cols[0].beginupdate;
for i := 0 to student.count-1
begin
  stringGrid.cell[0,i] := IntToStr(student.list[i].student.height);
end
stringGrid.cols[0].endupdate;

beginupdate & endupdateÀÇ ±â´ÉÀÌ colume 0 ¿¡¼­ ¼¿°ªÀÌ º¯°æÀÌ µÇ´õ¶óµµ 
È­¸é¿¡ ½Ç½Ã°£À¸·Î »Ñ¸®Áö ¸»°í loop °¡ ³¡³ª°í endupdate °¡ ½ÇÇà ÇÏ°Ô µÇ¸é 
±× ¶§ È­¸é¿¡ »Ñ¸®¶ó´Â Àǹ̷Π¾Ë°í ÀÖ½À´Ï´Ù. ¸Â³ª¿ä?

±×·¸´Ù¸é 

stringGrid.cols[0].beginupdate;
stringGrid.cols[1].beginupdate;
stringGrid.cols[2].beginupdate;

for i := 0 to student.count-1
begin
  stringGrid.cell[0,i] := IntToStr(student.list[i].student.height);
  stringGrid.cell[1,i] := IntTostr(student.list[i].student.weight);
  stringGrid.cell[2,i] := IntTostr(student.list[i].student.number);

end
stringGrid.cols[0].endupdate;
stringGrid.cols[1].endupdate;
stringGrid.cols[2].endupdate;

ÀÌ·¸°Ô Çϸé cols[1], cols[2]¸¦ Ç߱⠶§¹®¿¡ colume 1, 2 µµ ¼¿°ªÀÌ º¯°æÀÌ µÇ´õ¶ó°í
È­¸é¿¡ ½Ç½Ã°£À¸·Î »Ñ¸®Áö ¾Ê°í endupdate ÀÌÈÄ Çѹø¿¡ È­¸éÀ» »Ñ·ÁÁÖ°Ô µÇ´Â°Ç°¡¿ä?
(À§ÀÇ »óȲ¿¡¼­ stringgrid.col[1].beginupdate, endupdate, stringgrid.col[2].beginupdate, endupdate 
´Â ÀÖÀ¸³ª ¾øÀ¸³ª ¼Óµµ°¡ °°´õ¶ó°í¿ä.. ±×·¡¼­ Áú¹®À» ÇÏ°Ô µÇ¾ú½À´Ï´Ù)


ÀÌ»óÀÔ´Ï´Ù. ½Ç·ÂÀÌ ºÎÁ·ÇÏ¿©¼­ ±âÃÊÀûÀΠÁú¹®ÀÏ ¼öµµ ÀÖÀ»°Å °°Àºµ¥ Áú¹®À» ¿Ã·È½À´Ï´Ù.
°¨»çÇÕ´Ï´Ù.