简体   繁体   English

如何在c#中使用BMP图像文件作为winform的背景

[英]how to Use BMP image file for background of winform in c#

I have winform and i use image.BMP for background of my form and when i run it This happened : 我有winform,我使用image.BMP作为我的表单的背景,当我运行它时发生这种情况:

在此输入图像描述

It is working but my problem is background of datagridview I don't want to see the behind the datagridview How can i run that form with showing datagridview normally? 它工作但我的问题是datagridview的背景我不想看到datagridview背后如何运行该表单正常显示datagridview?

You need to use loop and change color of each cell. 您需要使用循环并更改每个单元格的颜色。 Do it after set datasource. 在设置数据源之后执行此操作。

foreach (DataGridViewRow row in yourDataGridView.Rows) 
    {
         row.DefaultCellStyle.BackColor = Color.White; 
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM