//读取
private void showMess()
{
this.dataGridViewX2.Rows.Clear();
//将车辆信息一行行添加到datagreatview 里面
StreamReader sr = File.OpenText("C:\\Users\\Administrator\\Desktop\\CarMessages.txt");
string line;
int i = ; List<string> list = new List<string>();
while ((line = sr.ReadLine()) != null)
{ list.Add(line);
i++; }
dataGridViewX2.Rows.Add(i);
int qq = list.Count;
for (int a = ; a < qq; a++)
{
dataGridViewX2.Rows[a].Cells[].Value = list[a].ToString();
}
//列宽自适应
dataGridViewX2.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
dataGridViewX2.ReadOnly = true;
}
写入Text
try
{
MultiFormatWriter mutiWriter = new com.google.zxing.MultiFormatWriter();
ByteMatrix bm = mutiWriter.encode( table.Rows[]["CarID"].ToString() , com.google.zxing.BarcodeFormat.QR_CODE, , );
Bitmap img = bm.ToBitmap(); string filename = "C:\\Users\\Administrator\\Desktop\\Car_Messages\\" + table.Rows[]["MenName"].ToString() + table.Rows[]["CarID"].ToString() + ".jpg";
img.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg); }
catch (Exception ee)
{ MessageBox.Show(ee.Message); }
}