的WinForms:控制的最大尺寸是65535 - 解决方法? [英] WinForms: Maximum Size of a Control is 65535 - Workaround?

查看:126
本文介绍了的WinForms:控制的最大尺寸是65535 - 解决方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在WinForms和C#,看来我不能创建宽于65535。如果我将它设置为70.000,该值被重置为65535
控制通过Control.Size与ILSpy源挖。我不'T立即找到负责夹紧大小不同的代码。

In WinForms and C#, it seems I cannot create a control wider than 65535. If I set it to 70.000, the value gets reset to 65535. Digging through the source of Control.Size with ILSpy, I couldn't immediately find the code responsible for clamping the size.

所以这是Win32 API或Windows窗体的限制吗?有没有解决这个问题,例如,任何方式与非托管互操作?

So is this a limit of the Win32 API or of Windows Forms? Is there any way around this, e.g. with unmanaged interop?

我需要这样一个大的控制的原因是我画的很长的音频文件的音乐波形到它。 (是的,我可以直接绘制波形,没有一个包含控制,但是这将需要大量的重构)。我说的不是绘图代码在这里。显然,有必要只绘制可见部分,但事情是,我想有尽可能广泛200.000像素的控制。

The reason I need such a large control is that I draw music waveform of very long audio files onto it. (Yes, I could draw the waveform directly, without a containing control; but that would require lots of refactoring). I am not talking about the drawing code here. Clearly it's necessary to draw only the visible part, but the thing is that I'd like to have a control as wide as 200.000 pixels.

推荐答案

这是一个WINAPI限制。一个漂亮的硬的,鼠标的位置报道,比方说,与挤进LPARAM参数鼠标位置的WM_MOUSEMOVE消息。随着对X-16位和Y型的位置16位。

It is a winapi restriction. A pretty hard one, the mouse position is reported with, say, the WM_MOUSEMOVE message with the mouse position packed into the LPARAM argument. With 16 bits for the X- and 16-bits for Y-location.

您必须处理它。它不是例如限制面板的AutoScrollMinSize属性还。这就是你永远在这种情况下使用,无论如何,在开始画AutoScrollPosition

You'll have to deal with it. It is not a limitation on for example the AutoScrollMinSize property of a panel. Which is what you'd always use in this case anyway, start painting at AutoScrollPosition.

这篇关于的WinForms:控制的最大尺寸是65535 - 解决方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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