锚定与自定义控件结合的问题 [英] Problems with Anchoring in combination with custom controls

查看:67
本文介绍了锚定与自定义控件结合的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个带有标准控件和自定义控件的Windows窗体

(Windows 7(64),Visual Studio 2010,VB.Net)。



当我在正常状态下启动表单时,一切正常。当我第一次最大化一切仍然是好的。当我再次返回正常状态时,锚定在底部或右侧的标准控件不再显示在正确的位置上。它们遍布各种形式。



当我再次最大化时,它变得更加混乱,当我重复这几次时,它们甚至可能完全消失了。



当我打电话给另一个子表格并返回主表格时也会发生这种情况。



问题只出现在组合中使用自定义控件。作为自定义控件一部分的控件(固定在右侧或底部)都在此自定义控件中正常运行。



我知道这必须是某种错误,因为我在互联网上看到其他人也遇到过这个问题,但我无法在任何地方找到一个好的答案。



请,只做回复你自己遇到这个问题,当你找到一个好的解决方案。



提前致谢,

Wietze

I have created a Windows form with standard controls and a custom control
(Windows 7 (64), Visual Studio 2010, VB.Net).

When I start the form in normal state, everything is OK. When I first maximize everything still is OK. When I go back tot normal again, then the standard controls that are anchored to the bottom or to the right are not displayed on the correct positions anymore. They become scattered all over the form.

When I maximize again it becomes even a bigger chaos and when I repeat this a couple of times they may even be gone completely out of sight.

This also happens when I call another sub form and return back to his main form.

The problem only appears in combination with custom controls. The controls that are part of the custom control (with anchoring to the right or to the bottom) are all functioning correct inside this custom control.

I know this must be some kind of a bug, because I have seen others too with this problem on the internet, but I cannot find a good answer anywhere.

Please, do respond only if you have encountered this problem yourself and when you have found a good solution.

Thanks in advance,
Wietze

推荐答案

谢尔盖,我不明白为什么我不应该使用锚定。如果它不是正确的做事方式,那为什么微软在VB中包含这个漂亮的方法呢?



我做了更多实验。我将自定义控件停靠在面板等中,但始终存在同样的问题。最后,我做了一个解决方法,并重新计算了在Form SizeChanged中狂暴的控件的位置。案件为我解决了。
Sergey, I do not see why I should not use anchoring. If it is not the right
way to do things, then why did Microsoft include this beautiful method in VB ?

I did some more experimentation. I docked the custom control in a panel etc. but always the same trouble. Finally I made a workaround and recalculated the location of the controls that went berserk in the Form SizeChanged. Case solved for me.


这篇关于锚定与自定义控件结合的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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