public void OnClose(int Reason)
        {
            m_CloseReason = (swPropertyManagerPageCloseReasons_e)Reason;

            var arg = new PageClosingArg();

            try
            {
                Closing?.Invoke(m_CloseReason, arg);
            }
            catch (Exception ex)
            {
                arg.Cancel       = true;
                arg.ErrorMessage = ex.Message;
            }

            if (arg.Cancel)
            {
                if (!string.IsNullOrEmpty(arg.ErrorTitle) || !string.IsNullOrEmpty(arg.ErrorMessage))
                {
                    var title = !string.IsNullOrEmpty(arg.ErrorTitle) ? arg.ErrorTitle : "Error";

                    m_App.HideBubbleTooltip();

                    m_App.ShowBubbleTooltipAt2(0, 0, (int)swArrowPosition.swArrowLeftTop,
                                               title, arg.ErrorMessage, (int)swBitMaps.swBitMapTreeError,
                                               "", "", 0, (int)swLinkString.swLinkStringNone, "", "");
                }

                const int S_FALSE = 1;
                throw new COMException(arg.ErrorMessage, S_FALSE);
            }
        }
        public static void ShowBubbleTooltip(this ISldWorks app,
                                             string title, string message, BubbleTooltipPosition_e pos, Image img = null)
        {
            var hwnd = new IntPtr(app.IFrameObject().GetHWnd());

            int x        = 0;
            int y        = 0;
            int xOffset  = 0;
            var arrowPos = swArrowPosition.swArrowNone;

            var doc = app.IActiveDoc2;

            if (doc != null)
            {
                xOffset = doc.GetFeatureManagerWidth();

                var view = doc.IActiveView;

                if (view != null)
                {
                    hwnd = new IntPtr(view.GetViewHWnd());
                }
            }

            RECT rect;

            GetWindowRect(hwnd, out rect);

            switch (pos)
            {
            case BubbleTooltipPosition_e.TopLeft:
                x        = rect.Left;
                y        = rect.Top;
                arrowPos = swArrowPosition.swArrowLeftTop;
                break;

            case BubbleTooltipPosition_e.TopRight:
                x        = rect.Right;
                y        = rect.Top;
                arrowPos = swArrowPosition.swArrowRightTop;
                break;

            case BubbleTooltipPosition_e.BottomRight:
                x        = rect.Right;
                y        = rect.Bottom;
                arrowPos = swArrowPosition.swArrowRightBottom;
                break;

            case BubbleTooltipPosition_e.BottomLeft:
                x        = rect.Left;
                y        = rect.Bottom;
                arrowPos = swArrowPosition.swArrowLeftBottom;
                break;
            }

            x += xOffset;

            var imgPath = "";

            if (img != null)
            {
                imgPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
                img.Save(imgPath);
            }

            app.ShowBubbleTooltipAt2(x, y, (int)arrowPos,
                                     title, message, (int)swBitMaps.swBitMapUserDefined, imgPath, "", 0,
                                     (int)swLinkString.swLinkStringNone, "", "");
        }