您如何知道控件何时完成绘制. [英] How do you know when a control has finished drawing.

查看:82
本文介绍了您如何知道控件何时完成绘制.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好;

我正在创建一个自定义ListView控件,并且遇到了一个问题.没有加载事件,我也找不到我想要的WindProc消息.

没有人知道是否有一种方法可以找到控件何时已加载或完成了其最后的绘制,而无需使用表格来查找.如果控件完成了绘制本身,可以解决该问题吗?

谢谢George

Hi All;

I am creating a custom ListView control and have come across a question. There is no Loaded Event and i cant find a WindProc message for what i want either.

Does anyone know if there is a way of finding out when the control has either loaded or finished its last paint ect without using a form to find this out. Can the control work out if it has finished drawing itself?

Thanks George

推荐答案

我以前遇到过这个问题,我认为最简单的答案是您必须使用表格.

最简单的解决方案是向每个控件添加一个Initialized()函数,并从父窗体中调用它.

我尝试过的另一种方法(可能有点混乱)是处理控件中的ParentChanged()事件.设置父级后,检查它是否为Form,是否订阅FormLoaded事件(如果不是),则检查控件父级的父级,因此直到根为止,即当Parent == null时.
I''ve come accross this problem before, I think the simple answer is you have to use the form.

The simplest solution is to add an Initialised() function to each control and call this from the parent form.

Another way I tried once, that can get a bit messey, is to handle ParentChanged() event in your control. When the parent is set check if it is a Form, if it is subscribe to the FormLoaded event if it isn''t check the control parent''s parent and so one up to the root i.e. when Parent == null.


这篇关于您如何知道控件何时完成绘制.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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