c# - tablelayoutpanel 不会改变背景图片
问题描述
图片名称是从ini文件中加载的,第一次设置背景没有任何问题。但是,当它根据动作从ini文件中加载另一个图像时,它不会设置不同的背景。
var parser = new FileIniDataParser();
IniData data = parser.ReadFile("configuration.ini");
int panelRow = GetMyClass.toInt(data[config_PanelCount]["rowCount"]);
int panelColl = GetMyClass.toInt(data[config_PanelCount]["collCount"]);
string bckGround = data[config_PanelCount]["background"];
tableStolovi.Controls.Clear();
tableStolovi.BackgroundImage = null;
string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
Image bck = Image.FromFile(appPath + "\\" + bckGround);
tableStolovi.BackgroundImage = bck;
tableStolovi.BackgroundImageLayout = ImageLayout.Stretch;
如何每次为tablelayoutpanel设置背景
解决方案
您可以在设置新背景后尝试刷新 tableLayoutPanel。
tableStolovi.Refresh();
推荐阅读
- node.js - 如何获取jsdom中元素的className?
- reactjs - React.JS React-Router-Dom 在每条路由上应用 css
- sql-server-2008-r2 - 加入时的 SQL 案例
- tensorflow - 如何使用保存的模型描述和权重在 Keras 中进行迁移学习 SSD 对象检测
- c# - Azure 应用服务连接超时问题
- azure-active-directory - 在 Azure AD 中,授予来宾邀请者将被邀请者添加到组所需的最低权限是什么?
- python - 如何比较两个json文件并打印差异报告
- python - ImportError:没有名为 Cloudant 的模块
- azure-devops - Azure DevOps 发布管道,生产阶段权限防止更改整个管道
- r - Rstudio 中缺少数据