即使使用双缓冲,调整窗体上 ActiveX 视频控件的大小也会导致 C++ 中出现不必要的闪烁

发布于 2024-10-21 03:25:50 字数 968 浏览 8 评论 0原文

C++。 Borland Developer Studio 风格,但不确定这是否与这里相关。

我有一个 ActiveX 控件(来自 Axis Communications),用于显示来自摄像机的视频。它在正常操作中工作得很好,但我想用它做一些调整,这会导致问题。

如果以编程方式,我围绕表单移动组件(仅 x,y 坐标),则一切都很好 - 视频的矩形平滑地移动,没有闪烁。

但是,如果我调整组件的大小(再次在代码中),我会在下部和上部闪烁。右手边缘。我所说的闪烁是指它会在这些边缘上产生白色边框,该边框会增大并在实际图片上闪烁。

我尝试过 DoubleBuffering,但这并不能解决问题。

这是 ActiveX 问题吗?或者可能是轴组件问题?

有没有一种方法可以在不闪烁的情况下调整大小?


编辑:

进一步测试:

看来只有当我调整控件大小并同时移动控件时才会发生这种情况,不幸的是,这正是我想要做的(我正在放大和缩小)。

我用 Visual Basic 和 ActiveX 控件进行了一个简单的测试,效果很好。

Borland C++ 中完全相同的(转换后的)代码会出现闪烁。

C++ 测试代码(仅调整组件大小,保持中心点静态):

for (int i = 0; i < 100; i++)
{
    AxisMediaControl1->Width = AxisMediaControl1->Width - 2;
    AxisMediaControl1->Height = AxisMediaControl1->Height - 2;
    AxisMediaControl1->Top = AxisMediaControl1->Top + 1;
    AxisMediaControl1->Left = AxisMediaControl1->Left + 1;
    Sleep(50);
}

C++. Borland Developer Studio flavour, but not sure if that is relevant here.

I have an ActiveX control (From Axis Communications) that displays video from a camera. It works great in normal operation, but I want to do a little adjustment with it that is causing issue.

If, programatically, I move the component around the form (just x,y coordinates), everything is fine - the rectangle of video moves smoothly around, with no flicker.

However, if I resize the component (again, in code), I get flicker on the lower & right hand edges. And by flicker, I mean it causes a white border on those edges, that grows, and flickers over the actual picture.

I've tried DoubleBuffering, but that doesn't fix it.

Is this an ActiveX issue? Or possible an Axis Component issue?

Is there a way that resizing can be done without flicker?


EDIT:

Further testing:

It would appear that this only happens when I resize the control AND move the control at the same time, which unfortunately is what I want to do (I'm zooming in and out).

I put together a simple test in Visual Basic with the ActiveX control, and it works fine.

The exact (converted) same code in Borland C++ has the flicker.

The C++ test code (which just resizes the component, keeping the centre point static):

for (int i = 0; i < 100; i++)
{
    AxisMediaControl1->Width = AxisMediaControl1->Width - 2;
    AxisMediaControl1->Height = AxisMediaControl1->Height - 2;
    AxisMediaControl1->Top = AxisMediaControl1->Top + 1;
    AxisMediaControl1->Left = AxisMediaControl1->Left + 1;
    Sleep(50);
}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倦话 2024-10-28 03:25:50

我(希望是受过教育的)猜测是这是 Axis 组件的问题。也就是说,您的应用程序向 ActiveX 组件发送一个调整大小命令,并且该组件有一个事件循环,该循环根据其内部存储的几何图形进行绘制,但它没有正确更新几何图形。

我建议创建一个简单的示例并将其发送给安讯士技术支持,因为我以前曾与他们合作过,并且总是发现它们非常有帮助。

My (hopefully educated) guess would be that it's an issue with the Axis component. That is, your application sends a resize command to the ActiveX component, and that component has an event loop which does the painting based upon it's internally stored geometry, and it is not updating the geometry correctly.

I would suggest creating a simple example and sending it to Axis technical support as I've worked with them before and always found them quite helpful.

究竟谁懂我的在乎 2024-10-28 03:25:50

这似乎是 Borland 和 ActiveX 控件的渲染/调整大小的问题。

当我更改代码以使用“SetWindowPos”API 而不是仅仅调整组件大小时,问题就消失了!

This appears to be an issue with Borland and rendering/resizing of ActiveX controls.

When I altered the code to use the 'SetWindowPos' API instead of just resizing the component, the issues went away!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文