Delphi:ButtonedEdit +框架=错误
Delphi XE。
有一个按钮编辑(带有左侧按钮),一个带有按钮图片的图像列表。一切都在框架上(如果在表格上也可以)。
按钮在设计时没有缩进,但在运行时却有。
这是一个错误吗?
谢谢!
Delphi XE.
There is a Buttoned Edit (with the left button), an image list with a picture for the button. All is on a frame (it is Ok if on a form).
There is no an indent of the button in a design time, but it is in a run time.
Is it a bug?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,这是一个错误。由于某种原因,当编辑驻留在框架中时,
TButtonEdit
的Ctl3D
属性无法从 .dfm 文件中正确流式传输。流式传输导致Ctl3D
为False
而不是True
。然后,在
TEditButton.UpdateBounds
中执行以下代码:这就是将按钮的位置向右和向下移动 2 个像素。
您可以通过在代码中手动设置 Ctl3D 并强制再次调用
UpdateBounds
来解决该错误。我使用插入器完成了此操作:您可以将其包含在框架中,但请确保插入的
TButtonedEdit
的声明位于声明框架之前。或者,如果错误影响许多框架,请以通用单位声明它,并在使用ExtCtrls
后在框架中使用该单位。现在,对于为什么流不能正确设置 Ctl3D 的明显问题,我没有答案。也许比我更了解表单流的人可以启发我们!
Yes it's a bug. For some reason the
Ctl3D
property of theTButtonEdit
is not being streamed correctly from the .dfm file when the edit resides in a frame. The streaming is resulting inCtl3D
beingFalse
instead ofTrue
.Then, in
TEditButton.UpdateBounds
the following code executes:This is what is shifting the position of your button 2 pixels right and down.
You can work around the bug by manually setting Ctl3D in code and forcing
UpdateBounds
to be called again. I did this with an interposer:You can include this in your frame, but make sure that the declaration of the interposed
TButtonedEdit
is before your frame is declared. Or if the bug afflicts many frames, declare it in a common unit and use that unit in your frame after you useExtCtrls
.Now, as for the obvious question as to why the streaming doesn't set
Ctl3D
correctly, I have no answer for that. Perhaps someone more knowledgeable than I am about form streaming could enlighten us!