Delphi将Stringgrid指定行添加到Memo控件中.rar
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;
- 1
- 粉丝: 509
- 资源: 1万+
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助