顶部停靠控件超过32768像素 [英] Top-docking controls more than 32768 pixels

查看:130
本文介绍了顶部停靠控件超过32768像素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WinForms应用程序,可让您编辑文档.每个文档均由各章组成,并且每章都包含RTF块的集合.使用Dock = DockStyle.Top将RTF块加载到PanelControl中.

I have a WinForms application that allows you to edit documents. Each document is made of chapters and each chapter holds a collection of RTF blocks. The RTF blocks are loaded in a PanelControl using Dock = DockStyle.Top.

问题在于,当一章的总高度太大(估计> 32768像素)时,下部的块将无法正确对接:它们会彼此紧靠在一起.当尝试找出问题时,我注意到使用LabelControl这样的简单控件也会发生这种情况.

The problem is that when the total height of a chapter gets too large (estimating > 32768 pixels) the lower blocks are not properly docked: they appear behind one another. When trying to isolate the problem I noticed that this also happens with simpler controls like a LabelControl.

我尝试的方法是Refresh()Invalidate()PerformLayout之类的方法:它们将解决问题.

Things I tried are methods like Refresh(), Invalidate() and PerformLayout: they will not resolve the issue.

所做的帮助正在调整表单的大小.之后,正确布置所有控件.

What does help is resizing the form. After that all controls are laid out correctly.

任何人都可以在不调整表单大小的情况下帮助解决该问题吗?

Can anyone help on how to solve this without resizing the form?

附加了一个简单的演示项目来说明问题.

Attached a simple demo-project that illustrates the problem.

推荐答案

从我上面的评论(似乎确实是这里的问题):

From my comment above (seems really to be the problem here):

WinForms(通常是GDI)通常会表现出不可预测的状态.尽量避免这种情况.在可能出现的问题范围内,根本没有画出任何东西,在意外的代码位置出现了OverflowExceptions等.

WinForms (and the GDI in general) is often behaving unpredictably if one tries to use coordinates outside a 16 bit range. Try to avoid that. In the range of possible problems are things just not getting drawn at all, OverflowExceptions at unexpected code positions etc.

这篇关于顶部停靠控件超过32768像素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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