Delphi将Stringgrid指定行添加到Memo控件中.rar

时间:2022-07-30 03:23:10
【文件属性】:

文件名称:Delphi将Stringgrid指定行添加到Memo控件中.rar

文件大小:6KB

文件格式:RAR

更新时间:2022-07-30 03:23:10

Delphi源码-控件组件

Delphi将Stringgrid指定行添加到Memo控件中,选中StringGrid中的行,点击右下角的“添加”按钮,即可将选中的StringGrid行数据添加到下边的Memo控件中显示。部分源代码如下:   procedure TForm1.FormCreate(Sender: TObject);   begin    StringGrid1.Cells[0,0] := '商品编号';    StringGrid1.Cells[0,1] := 'cc10011';    StringGrid1.Cells[0,2] := 'cc10012';    StringGrid1.Cells[0,3] := 'cc10013';    StringGrid1.Cells[0,4] := 'cc10014';    StringGrid1.Cells[1,0] := '商品名称';    StringGrid1.Cells[1,1] := '苹果';    StringGrid1.Cells[1,2] := '香蕉';    StringGrid1.Cells[1,3] := '西红柿';    StringGrid1.Cells[1,4] := '西瓜';    StringGrid1.Cells[2,0] := '商品数量';    StringGrid1.Cells[2,1] := '200';    StringGrid1.Cells[2,2] := '150';    StringGrid1.Cells[2,3] := '300';    StringGrid1.Cells[2,4] := '130';    StringGrid1.Cells[3,0] := '商品金额';    StringGrid1.Cells[3,1] := '$5.00';    StringGrid1.Cells[3,2] := '$4.50';    StringGrid1.Cells[3,3] := '$1.50';    StringGrid1.Cells[3,4] := '$6.00';   end;   procedure TForm1.Button1Click(Sender: TObject);   var    i,col,row: Integer;   begin    row := StringGrid1.Row;    for col := 0 to StringGrid1.ColCount - 1 do    Memo1.Lines.Add(StringGrid1.Cells[col,row]);   end;


【文件预览】:
srcfans.com
----Stringgrid()
--------Project1.res(876B)
--------Unit1.dfm(1KB)
--------Project1.cfg(434B)
--------Unit1.pas(2KB)
--------Project1.dpr(188B)
--------Project1.dof(2KB)
--------Unit1.dcu(5KB)

网友评论