
用C#怎样把我的GridView控件生成的表格用一张图片画出来?
2个回答
展开全部
private void button1_Click(object sender,EventArgs e)
{
string fileName = string.Empty;
SaveFileDialog sf = new SaveFileDialog();
if(DialogResult.OK == sf.ShowDialog())
{
Bitmap bitmap = new Bitmap(dataGridView1.Bounds.Width,dataGridView1.Bounds.Height);
this.dataGridView1.DrawToBitmap(bitmap,new Rectangle(new Point(0,0),dataGridView1.Bounds.Size));
bitmap.Save(sf.FileName + ".bmp");
bitmap = null;
}
}
{
string fileName = string.Empty;
SaveFileDialog sf = new SaveFileDialog();
if(DialogResult.OK == sf.ShowDialog())
{
Bitmap bitmap = new Bitmap(dataGridView1.Bounds.Width,dataGridView1.Bounds.Height);
this.dataGridView1.DrawToBitmap(bitmap,new Rectangle(new Point(0,0),dataGridView1.Bounds.Size));
bitmap.Save(sf.FileName + ".bmp");
bitmap = null;
}
}

2024-07-20 广告
博思AIPPT是基于ai制作PPT的智能在线工具,它提供了4种AI制作PPT的方式,包括AI生成大纲、AI直接生成PPT、文本生成PPT、AI提炼word文档生成PPT,一站式集成多种AI生成PPT的方式,可满足办公用户的不同需求和使用场景...
点击进入详情页
本回答由博思aippt提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询