事件消失了 [英] event disappearing

查看:72
本文介绍了事件消失了的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有一个非常令人沮丧的问题....


我有一个自定义的Windows窗体控件,其中包含一个集合

控件,这些控件又包含其他控件,

的标题栏示例客户端可滚动区域等。我的组件需要能够

生成一个自定义点击(cardpanelclicked)事件,它有一个自定义的

eventargs类,显示单击了哪个控件,以及

点击了控件的区域,所以这个意味着我需要让我所包含的

课程通过父控件传播....到目前为止我一直在玩吗?


现在问题是,这是有效的如果我单步执行

调试器中的代码,那么很好,但是当我正常运行应用程序时,事件不会触发

或实际上它可能,它可能只是油漆事件迷路了,我不能确定,因为当我调试时,它按设计工作....我正在做

我的头脑, PLE如果可以的话,请帮忙!!!

问候Tim。


PS在稻草模式下摸索我尝试过DoEvents()和

Thread.Sleep(100)也无济于事。

Hi,

I have a really frustrating problem....

I have a custom windows form control that contains a collection of
controls, these controls in turn contain other controls, a titlebar for
example a client scrollable area etc. My component needs to be able to
generate a custom click (cardpanelclicked) event that has a custom
eventargs class that shows which control was clicked, and what area of
the control was clicked, so this means I need to have my contained
classes propogate up through the parent controls....with me so far ?

Now the thing is, this works fine if I step through the code in the
debugger, however when I run the app normally the event does not fire
or actually it may, it may just be the paint event getting lost, I
can''t tell for sure as when I debug, it works as designed....I am doing
my head in on this, please help if you can !!!
Regards Tim.

PS in groping at straws mode I have tried a DoEvents() and also a
Thread.Sleep(100) as well, to no avail.

推荐答案

Tim Jarvis写道:
Tim Jarvis wrote:


我有一个非常令人沮丧的问题....

我有一个自定义的Windows窗体控件,其中包含一组
控件,这些控件又包含其他控件,标题栏
例如客户端可滚动区域等。我的组件需要能够生成具有
自定义的自定义单击(cardpanelclicked)事件eventargs类,显示单击了哪个控件,以及单击了控件的哪个区域,这意味着我需要让我的
包含的类通过父控件传播....与我一起到目前为止?

现在问题是,如果我逐步调试
调试器中的代码,这样可行我正常运行应用程序事件不会触发
或实际上它可能,它可能只是油漆事件迷路了,我无法确定,因为我调试时,它按设计工作....我正在努力做到这一点,如果可以的话,请帮忙!!!

问候Tim。

PS在稻草模式下摸索我已经尝试过DoEvents()以及一个
Thread.Sleep(100)也无济于事。
Hi,

I have a really frustrating problem....

I have a custom windows form control that contains a collection of
controls, these controls in turn contain other controls, a titlebar
for example a client scrollable area etc. My component needs to be
able to generate a custom click (cardpanelclicked) event that has a
custom eventargs class that shows which control was clicked, and what
area of the control was clicked, so this means I need to have my
contained classes propogate up through the parent controls....with me
so far ?

Now the thing is, this works fine if I step through the code in the
debugger, however when I run the app normally the event does not fire
or actually it may, it may just be the paint event getting lost, I
can''t tell for sure as when I debug, it works as designed....I am
doing my head in on this, please help if you can !!!
Regards Tim.

PS in groping at straws mode I have tried a DoEvents() and also a
Thread.Sleep(100) as well, to no avail.






蒂姆贾维斯 <钛******* @ newsgroup.nospam>在消息中写道

news:ua ************** @ TK2MSFTNGP09.phx.gbl ...
"Tim Jarvis" <Ti*******@newsgroup.nospam> wrote in message
news:ua**************@TK2MSFTNGP09.phx.gbl...
现在问题是,如果我单步执行
调试器中的代码,这样可以正常工作,但是当我正常运行应用程序时,事件不会触发
或实际上它可能,它可能只是绘制事件获取丢失了,我无法确定当我调试时,它按设计工作
Now the thing is, this works fine if I step through the code in the
debugger, however when I run the app normally the event does not fire
or actually it may, it may just be the paint event getting lost, I
can''t tell for sure as when I debug, it works as designed




Debug.WriteLine可以方便地调试这类问题。


Tim

..NET的利弊
http://www.itwriting.com/phorum/list.php?f=6


你好蒂姆,


首先,我想确认一下我对你的问题的理解。从

您的描述中,我了解当

应用程序在发布模式下运行时,未触发自定义事件。但是,在调试模式下,它工作正常。如果

有任何误解,请随时告诉我。


如果它在调试模式下触发,我认为它也必须被解雇发布模式。

您能否在这里发布一些代码作为示例,以便我可以尝试在我的机器上重新编写它?b $ b通过一些源代码,我们可以更快地提供

的帮助。谢谢!


Kevin Yu

=======

此帖子已提供按原样没有保证,也没有赋予

权利。

Hi Tim,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that the custom event was not fired when the
app is running in release mode. However, in debug mode, it works fine. If
there is any misunderstanding, please feel free to let me know.

If it fires in debug mode, I think it has to be fired also in release mode.
Could you please post some of your code here for an example, so that I can
try to repro it on my machine? It will be more quickly for us to deliver
our assistance with some source code. Thanks!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


这篇关于事件消失了的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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