改变forecolor onpaint - bug? [英] change forecolor onpaint - bug?

查看:87
本文介绍了改变forecolor onpaint - bug?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张带有电子邮件的桌子。我希望正确的地址有黑色前景,而错误的地址有红色前色。如果地址被认为是错误的,则字段''WrgEmail''为真。

关于事件Paint(部分细节,连续表格)我有以下代码:

I have a table with emailaddresses. I want the correct addresses to have black forecolor and the wrong ones to have red forecolor. If the address is considered wrong, the field ''WrgEmail'' is true.
On the event Paint (section detail, continuous form) I have the following code:

展开 | 选择 | 换行 | 行号

推荐答案

使用continue表单时,每个控件都在所有记录之间共享。所以基本上如果你的控件EmailAddr改变了它的forecolor,这将适用于所有记录。颜色是跳跃的原因。当你点击一条记录时,是因为该记录得到了焦点,而且 Me!WrgEmail 的值会根据哪条记录有焦点而改变。



要以连续的形式实现所需的效果,您需要查看条件格式
When using a continues form, each control is shared between all the records. So basically if your control EmailAddr gets its forecolor changed this will apply to ALL records. The reason the color is "jumping" when you click a record, is because the record gets focus, and the value of Me!WrgEmail changes depending on which record has focus.


To achieve the effect you want in a continuous form, you need to look into Conditional Formatting.


Hi SmilyCoder!谢谢你的回复!但是如果你点击顶部的行,一次一行,那么它是否正常工作并不奇怪?但不是相反,或者你是否随机点击地址...

我已经尝试了条件格式化,但是当我滚动时所有都是黑色的,只有当我停止滚动红色时得到他们的颜色。用户需要能够为那些糟糕的人滚动并立即红色。所以这就是为什么我在这种情况下放弃了条件格式化。

现在我有一个解决办法:一个矩形改变背景颜色而不是改变forecolor的emailaddress。工作,但并不像我想要的那样漂亮......
Hi SmilyCoder! Thanks for response! But isn''t it strange that it works fine if you click on the rows from top, one at the time, down? But not the other way around or if you randomly click on addresses...
I''ve tried conditional formatting, but when I''m scrolling ALL are black, only when I stop scrolling the red ones get their color. The users need to be able to scroll and immidiately se red for those who are bad. So thats why I abandoned the conditional formatting in this case.
For now I have a work-around: a rectangle that Changes backcolor on paint instead of the emailaddress changing forecolor. Works, but isn''t as Beautiful as I wanted it...


我之前没有使用过onpaint。我甚至不确定它是否在AC2003中可用。我试过玩了一下,发现很难看出油漆事件是如何/什么时候以连续的形式四处移动。
I have not used the onpaint much before. I am not even sure if it was available in AC2003. I have tried playing around with it a bit, and find it difficult to see how/when the paint event fires in relation to moving around in a continuous form.


这篇关于改变forecolor onpaint - bug?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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