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);
}
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.
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!
精彩评论