请问您想实现什么功能需要获取此高度值?
When the Ribbon interface is used, to position popup windows and dynamics correctly, the global point requires a conversion to compensate for the height of the Ribbon.
This function converts the global point by increasing the point by the height of the Ribbon.
这是API文档中的一个函数,我的理解是:因为用了ribbon界面,所以需要对计算的屏幕坐标进行修正。因为调用这个函数比较麻烦,所以我想直接获取那个高度,然后自己计算。
这里你最终需要的是globlePoint而不是screenPt2d。 我是直接粘过来了另外一个帖子, 他想得到screen(monitor) point
C#里面怎么把第二个参数传到mdlWindow_globalPointConversionIncrease中去呢?
您需要用C++/CLI封装一下供C#调用,或者通过C#的PInvoke技术(可百度来学习)来调用C++函数。
目前高级的较低层的功能还仅存在于C++中,C#未封装。
嗯,正在加紧封装中,谢谢!
搞定,结贴,谢谢二位大佬!
C++端:
extern "C" __declspec(dllexport) void __stdcall worldPointToGlobalScreenPoint(int viewNumber, DPoint3d worldPoint, Point2d* globalScreenPoint) { MSDialogP viewWindow = mdlWindow_viewWindowGet(viewNumber);
DPoint3d viewPoint; DPoint3d screenPoint; viewWindow->GetViewport()->ActiveToView(&viewPoint, &worldPoint, 1); viewWindow->GetViewport()->ViewToScreen(&screenPoint, &viewPoint, 1); Point2d pointInMdl{ (int)screenPoint.x, (int)screenPoint.y };
if (mdlWindow_isGlobalPointConversionRequired(viewWindow->GetScreenNumber())) { mdlWindow_globalPointConversionIncrease(globalScreenPoint, viewWindow, &pointInMdl); }}
C#端:
[DllImport("MstnLib.dll")] public static extern void worldPointToGlobalScreenPoint(int viewNumber, Bentley.GeometryNET.DPoint3d worldPoint, ref Bentley.GeometryNET.Point2d globalScreenPoint);
Answer Verified By: lingwei liu
感谢分享!