在C#Windows窗体中使面板无效 [英] Invalidate Panel in C# windows Forms

查看:181
本文介绍了在C#Windows窗体中使面板无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类(主窗体类除外),可以在其中读取数据文件.读取数据后,我想将其显示在主窗体的面板上.

如何从数据读取类(类位于其他文件或其他项目中)中调用主窗体的OnPaint? (数据绘制的详细信息对该问题并不重要).

I have a class (other than main form class) where in I read a data file. After reading the data, I want to display it on the panel on the main form.

How can I call OnPaint of main form from data reading class (class is located in other file or other project)? (The details of data drawing are not important for the question).

推荐答案

您从哪里调用读取数据的方法?从主要形式?如果是这种情况,请在该调用之后立即调用invalid.
From where are you calling the method that reads data? From the Main Form? If that is the case, just after that call, call invalidate as well.



我尝试使用委托,但解决了.
Hi,
I tried using delegates and it solved.


这篇关于在C#Windows窗体中使面板无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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