如何访问/获取OnPaint"PaintEventArgs"在OnLeave中的"EventArgs"中 [英] How to access/get OnPaint "PaintEventArgs" in OnLeave "EventArgs"

查看:72
本文介绍了如何访问/获取OnPaint"PaintEventArgs"在OnLeave中的"EventArgs"中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从离开事件(OnLeave)的PaintEvent(OnPaint)中获取参数.任何想法如何访问/获取它们.

I want to get the arguments from PaintEvent (OnPaint) in the Leave Event (OnLeave). Any idea how to access/get them.

推荐答案

如果要在事件触发时进行绘画操作,则
使用 Invalidate()方法和一个标志,该标志现在将告诉您的绘画事件,有关是否应运行if-else块的事件离开.

if you want to do something in paint when leave event fire then
use Invalidate() method and a flag which will tell your paint event now, leave event regarding if-else block should be run or not.

boolean flag = false;

Leave event ...
{
   flag = true;
   Mycontrol1.Invalidate(); // it will fire paint event of Mycontrol1
}

MyControl1 paint event ...
{
     if (flag==true)
     {
        //draw something
        flag = false;
     }
}



祝您编程愉快!
:)



Happy coding!
:)


这篇关于如何访问/获取OnPaint"PaintEventArgs"在OnLeave中的"EventArgs"中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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