将TableLayoutPanel所有行保存到BMP文件 [英] Save TableLayoutPanel All Row to BMP File

查看:87
本文介绍了将TableLayoutPanel所有行保存到BMP文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码将TableLayoutPanel保存到文件:

I am using the following codes to save the TableLayoutPanel to file :

Bitmap bitmap = new Bitmap(tableLayoutPanel1.Width, tableLayoutPanel1.Height );
tableLayoutPanel1.DrawToBitmap(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height));
bitmap.Save("C:\\Temp\\Test.bmp");


我的问题是上述代码仅保存tableLayoutPanel1的〜20行数据的屏幕转储".有> tableLayoutPanel1中有60行.如何保存所有行?用户正在使用垂直滚动条查看tableLayoutPanel1中的所有数据.

非常感谢.
JasHFR


My problem is the above codes only save ''a screen dump'' of ~20 rows data of tableLayoutPanel1. There are > 60 rows in tableLayoutPanel1. How can I save all rows ? User is using a vertical scroll bar to view all data in tableLayoutPanel1.

Many Thanks.
JasHFR

推荐答案

这可能有用.我不确定,但值得一试.

This might work. I am not sure but worth a try.

Bitmap bitmap = new Bitmap(tableLayoutPanel1.Width, tableLayoutPanel1.RowCount * tablelayoutPanel1.GetRowHeights()[0]);
tableLayoutPanel1.DrawToBitmap(bitmap, new Rectangle(0, 0, bitmap.Width, bitmap.Height));
bitmap.Save("C:\\Temp\\Test.bmp");


这篇关于将TableLayoutPanel所有行保存到BMP文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆