请问您想实现什么功能需要获取此高度值?
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界面,所以需要对计算的屏幕坐标进行修正。因为调用这个函数比较麻烦,所以我想直接获取那个高度,然后自己计算。
是的。在加上一个判断。
if (mdlWindow_isGlobalPointConversionRequired (viewWindow->GetScreenNumber ()))
mdlWindow_globalPointConversionIncrease (&globlePoint, viewWindow, &pointInMDLclient);
Answer Verified By: Yongan.Fu
不知能否直接得那个高度,我再看看。感觉不可以。
我看了这个函数的实现,只是在不同窗口之间进行client, screen之间的转换,没有
因为ribbon还有minimize状态,所以最好用mdlWindow_globalPointConversionIncrease 进行转换
// note: you can use the following corrected code piece to get pure windows screen point for the button event.
// both pointInMDLclient and globlePoint are in a window coordinates which is relative to a window rect.
// as you said, Viewport::ViewToScreen don't return screen point in fact.
// please focus on the using of mdlWindow_globalPointConversionIncrease which is the key point here.
// other changes just rename the variable names to make it's meaning more accurate.
//
// ev.GetViewPoint returns the mouse position of client area of the view window,
// Viewport::ViewToScreen returns the point which is relative to left-up corner of a special client window which
// is the gray area to contain the 8 view windows. The special client window is like the Win32
// MDClient for multi-document program, and we also call it usable area
DPoint3d pointInMDLclient3D = { 0 };
ev.GetViewport ()->ViewToScreen (&pointInMDLclient3D, ev.GetViewPoint (), 1);
Point2d pointInMDLclient = { (int)pointInMDLclient3D.x, (int)pointInMDLclient3D.y };
// in CE, because there is ribbon bar, we must convert the pointInMDLclient to global point which is relative to
// the left-up conner of the main frame window.
Point2d globlePoint = { 0 };
MSDialogP viewWindow = mdlWindow_viewWindowGet (ev.GetViewNum ());
else
globlePoint = pointInMDLclient;
// now use mdlWindow_globalPointToScreen to convert the global point to screen point which is pure windows concept
// but not the Microstation concept, and I don't think there is equivalent C++ method in DgnButtonEvent or other class
Point2d screenPt2d = { 0 };
mdlWindow_globalPointToScreen (&screenPt2d, mdlWindow_viewWindowGet (ev.GetViewNum ()), &globlePoint);
这里你最终需要的是globlePoint而不是screenPt2d。 我是直接粘过来了另外一个帖子, 他想得到screen(monitor) point