private void CopyDGVToClipBoard(DataGridView dgv)
{
int height, width;
height = dgv.ColumnHeadersHeight + dgv.Rows.GetRowsHeight(DataGridViewElementStates.Visible) + 1;
width = dgv.Columns.GetColumnsWidth(DataGridViewElementStates.Visible) + 2;
Bitmap image = new Bitmap(width, height);//初始化一个相同大小的窗口
dgv.DrawToBitmap(image, new Rectangle(0, 0, width, height));
Clipboard.SetImage(image);//保存到Clipboard中
}
C#:DataGridView里的显示内容复制成图片,放在剪贴版中
猜你喜欢
转载自blog.csdn.net/jyh_jack/article/details/81166244
今日推荐
周排行