[英]How to add background image to a Windows form gridview?
我想知道是否有任何方法可以在Windows窗体中将背景图像放到GridView中...我正在使用C#
using the OnPaint event you could do something like this 使用OnPaint事件,您可以执行以下操作
private void dataGridView1_Paint(object sender, PaintEventArgs e)
{
DataGridView dgv = (DataGridView) sender;
int i = dgv.Rows.GetRowsHeight(DataGridViewElementStates.Visible);
e.Graphics.DrawImage(Properties.Resources.BackGround, new Rectangle(0, i, dgv.Width, (dgv.Height - i)));
}
EDIT This works to detect the Rows, but it doesn't seem to detect the UserAddRow option on the bottom, if that is a need. 编辑这可以检测到行,但是如果需要的话,它似乎无法检测到底部的UserAddRow选项。 I am at a loss.
我很茫然。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.