简体   繁体   中英

ActiveX Control will not resize or move

I am developing a C# application that runs instrumentation. I would like to include some ActiveX controls provided by the manufacturer. I have installed and registered the controls and added them to my tool box in Visual Studio. When I add the control to my form it is forced to the upper left hand corner (0,0) and size (0,0). If I try to resize or move the control in the properties menu it returns to (0,0). When I add the control to my toolbox it ends up in my "General" category.

I have tried setting the size programmatically as well. If I set a minimum or maximum size I can retrieve a non-zero size from the control but I will not see the control in my form. The control is quite old, and works in VB6 in XP virtual desktop. Any help on this would be appreciated.

Per Sjips suggestion I opened up the ActiveX control using the WebBrowser Control within my form. With the HTML Code:

 <!DOCTYPE html> <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8" /> <title></title> </head> <body> <center> MVC Diplay <p></p> <div id="DivId"> <script> var mvc = document.createElement('object'); DivId.appendChild(mvc); mvc.width = "800"; mvc.height = "500"; mvc.classid = "CLSID:78559301-09D8-11D2-85D3-204C4F4F5020"; </script> </div> </center> </body> </html> 

It was also required to add the following to the "Post-build event command line:"

call "$(DevEnvDir)..\\tools\\vsvars32.bat"

editbin.exe /NXCOMPAT:NO "$(TargetPath)"

I also had to set the build target to x86.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM