示例#1
0
 public void ShowContextMenu(uint dwID, ref tagPOINT ppt, object pcmdtReserved, object pdispReserved)
 {
     if (this.m_defaultUIHandler != null)
     {
         this.m_defaultUIHandler.ShowContextMenu(dwID, ref ppt, pcmdtReserved, pdispReserved);
     }
 }
示例#2
0
        // Uses Windows UI Automation API to determine if we should click and Drag in context Mode
        private void uiAutomationCheck(Point p)
        {
            tagPOINT reference = new tagPOINT();

            reference.x = p.X;
            reference.y = p.Y;

            if (this.status.getCurrentMode() != ProgramMode.clickAndDrag)
            {
                try
                {
                    IUIAutomationElement focus = this.automator.ElementFromPoint(reference);

                    // Useful for debugging API support
                    System.Diagnostics.Debug.Print(focus.CurrentControlType.ToString());
                    System.Diagnostics.Debug.Print("localized:" + focus.CurrentLocalizedControlType);

                    if ((focus.CurrentControlType == 50037 && this.parameters.contextValues.supportTitleBars) ||
                        (focus.CurrentControlType == 50027 && this.parameters.contextValues.supportScrollBars) ||
                        (focus.CurrentControlType == 50018 && this.parameters.contextValues.supportTabs))
                    {
                        this.status.setCurrentMode(ProgramMode.clickAndDrag);
                    }
                }
                catch (COMException e)
                {
                    // No element given, give up
                }
            }
        }
示例#3
0
        // IDocHostUIHandler Implementation

        public int ShowContextMenu(uint dwID, ref tagPOINT ppt,
                                   [MarshalAs(UnmanagedType.IUnknown)] object pcmdtReserved,
                                   [MarshalAs(UnmanagedType.IDispatch)] object pdispReserved)
        {
            if (container.IsContextMenuEnabled)
            {
                if (container.ContextMenu != null)
                {
                    //show the assigned ContextMenu
                    System.Drawing.Point pt = new System.Drawing.Point(ppt.x, ppt.y);
                    pt = container.PointToClient(pt);
                    container.ContextMenu.Show(container, pt);
                    return(HRESULT.S_OK);
                }
                else
                {
                    //show the default IE ContextMenu
                    return(HRESULT.S_FALSE);
                }
            }
            else
            {
                return(HRESULT.S_OK);
            }
        }
示例#4
0
        int IDocHostUIHandler.ShowContextMenu(uint dwID, ref tagPOINT pt, object pcmdtReserved, object pdispReserved)
        {
            // return Hresults.S_OK; //Do not display context menu
            // return Hresults.S_FALSE; //Default IE ctxmnu

            //Raise event
            if (WBContextMenu != null)
            {
                //Screen coordinates
                Point outpt = new Point(pt.x, pt.y);
                //Client coordinates
                Point        clientpt = this.PointToClient(outpt);
                IHTMLElement elem     = this.ElementFromPoint(clientpt.X, clientpt.Y);

                ContextMenuEvent.SetParameters((WB_CONTEXTMENU_TYPES)dwID, outpt, clientpt, elem, elem);
                WBContextMenu(this, ContextMenuEvent);
                if (ContextMenuEvent.displaydefault == false) //Handled or don't display
                {
                    return(Hresults.S_OK);
                }
                ContextMenuEvent.dispctxmenuobj = null;
                ContextMenuEvent.ctxmenuelem    = null;
            }
            return(Hresults.S_FALSE);
        }
示例#5
0
        public bool TryGetClickablePoint(out Point pt)
        {
            pt = new Point(0, 0);
            tagPOINT nativePoint = new tagPOINT();

            try
            {
                bool success = this._obj.GetClickablePoint(out nativePoint) != 0;
                if (success)
                {
                    pt.X = nativePoint.x;
                    pt.Y = nativePoint.y;
                }
                return(success);
            }
            catch (System.Runtime.InteropServices.COMException e)
            {
                Exception newEx; if (Utility.ConvertException(e, out newEx))
                {
                    throw newEx;
                }
                else
                {
                    throw;
                }
            }
        }
        internal static tagPOINT PointManagedToNative(Point pt)
        {
            tagPOINT nativePoint = new tagPOINT();

            nativePoint.x = pt.X;
            nativePoint.y = pt.Y;
            return(nativePoint);
        }
示例#7
0
        /// <summary>
        /// 把像素(屏幕)距离转化成为地图上的距离
        /// </summary>
        private double ConvertPixelDistanceToMapDistance(double PixelDistance)
        {
            tagPOINT tagP = new tagPOINT();
            WKSPoint wksP = new WKSPoint();

            tagP.x = ( int )PixelDistance;
            tagP.y = ( int )PixelDistance;
            (m_CurrentMap as IActiveView).ScreenDisplay.DisplayTransformation.TransformCoords(ref wksP, ref tagP, 1, 6);
            return(wksP.X);
        }
示例#8
0
        public virtual Int32 GetLocation(out tagPOINT pPoint, Int32 fTranslate)
        {
            ParameterModifier[] modifiers = Invoker.CreateParamModifiers(true, false);
            pPoint = new NetOffice.MSHTMLApi.tagPOINT();
            object[] paramsArray = Invoker.ValidateParamsArray(pPoint, fTranslate);
            object   returnItem  = Invoker.MethodReturn(this, "GetLocation", paramsArray, modifiers);

            pPoint = (tagPOINT)paramsArray[0];
            return(NetRuntimeSystem.Convert.ToInt32(returnItem));
        }
示例#9
0
        public virtual Int32 moveToPoint(tagPOINT ptPoint, NetOffice.MSHTMLApi.Enums._COORD_SYSTEM eCoordSystem, NetOffice.MSHTMLApi.IHTMLElement pElementContext, Int32 dwHitTestOptions, out Int32 pdwHitTestResults)
        {
            ParameterModifier[] modifiers = Invoker.CreateParamModifiers(false, false, false, false, true);
            pdwHitTestResults = 0;
            object[] paramsArray = Invoker.ValidateParamsArray(ptPoint, eCoordSystem, pElementContext, dwHitTestOptions, pdwHitTestResults);
            object   returnItem  = Invoker.MethodReturn(this, "moveToPoint", paramsArray, modifiers);

            pdwHitTestResults = (Int32)paramsArray[4];
            return(NetRuntimeSystem.Convert.ToInt32(returnItem));
        }
示例#10
0
        public virtual Int32 TransformLocalToGlobal(tagPOINT ptLocal, out tagPOINT pptGlobal)
        {
            ParameterModifier[] modifiers = Invoker.CreateParamModifiers(false, true);
            pptGlobal = new NetOffice.MSHTMLApi.tagPOINT();
            object[] paramsArray = Invoker.ValidateParamsArray(ptLocal, pptGlobal);
            object   returnItem  = Invoker.MethodReturn(this, "TransformLocalToGlobal", paramsArray, modifiers);

            pptGlobal = (tagPOINT)paramsArray[1];
            return(NetRuntimeSystem.Convert.ToInt32(returnItem));
        }
示例#11
0
        public virtual Int32 HitTestPoint(tagPOINT pt, out Int32 pbHit, out Int32 plPartID)
        {
            ParameterModifier[] modifiers = Invoker.CreateParamModifiers(false, true, true);
            pbHit    = 0;
            plPartID = 0;
            object[] paramsArray = Invoker.ValidateParamsArray(pt, pbHit, plPartID);
            object   returnItem  = Invoker.MethodReturn(this, "HitTestPoint", paramsArray, modifiers);

            pbHit    = (Int32)paramsArray[1];
            plPartID = (Int32)paramsArray[2];
            return(NetRuntimeSystem.Convert.ToInt32(returnItem));
        }
示例#12
0
        //把像素(屏幕)距离转化成为地图上的距离
        public static double ConvertPixelDistanceToMapDistance(IActiveView pActiveView, double pPixelDistance)
        {
            tagPOINT tagPOINT = new tagPOINT();

            tagPOINT.x = Convert.ToInt32(pPixelDistance);
            tagPOINT.y = Convert.ToInt32(pPixelDistance);

            WKSPoint pWKSPoint = new WKSPoint();

            pActiveView.ScreenDisplay.DisplayTransformation.TransformCoords(ref pWKSPoint, ref tagPOINT, 1, 6);

            return(pWKSPoint.X);
        }
示例#13
0
        public int UpdateUI()
        {
            if (this.mFullyActive && (this.m_document != null) && (this.container.mDesignMode == true))
            {
                try
                {
                    mshtml.HTMLDocument thisdoc = (mshtml.HTMLDocument)m_document;

                    //we need IDisplayServices to get the caret position
                    mshtml.IDisplayServices ds = (IDisplayServices)thisdoc;

                    if (ds == null)
                    {
                        return(HRESULT.S_OK);
                    }


                    IHTMLCaret caret;
                    ds.GetCaret(out caret);

                    if (caret == null)
                    {
                        Debug.WriteLine("caret was null");
                        return(HRESULT.S_OK);
                    }

                    tagPOINT pt = new tagPOINT();

                    caret.GetLocation(out pt, 1);

                    IHTMLElement el = thisdoc.elementFromPoint(pt.x, pt.y);

                    if (el == null)
                    {
                        Debug.WriteLine("pt was null");
                        return(HRESULT.S_OK);
                    }

                    container.mcurrentElement = el;
                    container.InvokeUpdateUI(el);
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e.Message + e.StackTrace);
                }
            }

            //should always return S_OK unless error
            return(HRESULT.S_OK);
        }
示例#14
0
        //ÉÁ˸Ïß²¢¸ßÁÁÏÔʾ
        private static void FlashLineAndHiLight(IActiveView pActiveView, IGeometry pGeometry, int interval)
        {
            IScreenDisplay    pDisplay    = pActiveView.ScreenDisplay;
            ISimpleLineSymbol pLineSymbol = new SimpleLineSymbolClass();
            ISymbol           pSymbol;
            IRgbColor         pRGBColor;

            tagPOINT tagPOINT = new tagPOINT();
            WKSPoint WKSPoint = new WKSPoint();

            tagPOINT.x = (int)1;
            tagPOINT.y = (int)1;
            pDisplay.DisplayTransformation.TransformCoords(ref WKSPoint, ref tagPOINT, 1, 6);

            pLineSymbol = new SimpleLineSymbolClass();
            //if (pActiveView.FocusMap.MapScale != 0)
            //{
            //    pLineSymbol.Width = WKSPoint.X * 10000 / pActiveView.FocusMap.MapScale;
            //}
            //else
            //{
            //    pLineSymbol.Width = WKSPoint.X / 2;
            //}
            pLineSymbol.Width = WKSPoint.X;

            pRGBColor       = new RgbColorClass();
            pRGBColor.Green = 148; //148
            pRGBColor.Red   = 32;  //32
            pRGBColor.Blue  = 0;

            pSymbol      = pLineSymbol as ISymbol;
            pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen;

            pDisplay.SetSymbol(pSymbol);
            pDisplay.DrawPolyline(pGeometry);
            System.Threading.Thread.Sleep(interval);
            pDisplay.DrawPolyline(pGeometry);
            pLineSymbol.Width = 3;
            IElement pEle = new LineElementClass();//yjl¸ßÁÁÏÔʾ

            pEle.Geometry = pGeometry;
            (pEle as ILineElement).Symbol     = pSymbol as ILineSymbol;
            (pEle as IElementProperties).Name = _FlashTagName;
            (pActiveView as IGraphicsContainer).AddElement(pEle, 0);
            pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, pEle, null);
            //pActiveView.PartialRefresh(esriViewDrawPhase.esriViewBackground, pEle, null);
        }
示例#15
0
        public WebDragSourceAction dragSourceActionMaskForPoint(WebView WebView, ref tagPOINT point)
        {
            Node e = owner.ElementAtPoint(new Point(point.x, point.y));

            if (e.Type == ElementType.Image)
            {
                return(WebDragSourceAction.WebDragSourceActionImage);
            }
            else if (e.Type == ElementType.LinkOrUknown)
            {
                return(WebDragSourceAction.WebDragSourceActionLink);
            }
            else if (!string.IsNullOrEmpty(owner.SelectedText))
            {
                return(WebDragSourceAction.WebDragSourceActionSelection);
            }
            else
            {
                return(WebDragSourceAction.WebDragSourceActionAny);
            }
        }
示例#16
0
        //ÉÁ˸Ïß
        private static void FlashLine(IActiveView pActiveView, IGeometry pGeometry, int interval)
        {
            IScreenDisplay    pDisplay    = pActiveView.ScreenDisplay;
            ISimpleLineSymbol pLineSymbol = new SimpleLineSymbolClass();
            ISymbol           pSymbol;
            IRgbColor         pRGBColor;

            tagPOINT tagPOINT = new tagPOINT();
            WKSPoint WKSPoint = new WKSPoint();

            tagPOINT.x = (int)1;
            tagPOINT.y = (int)1;
            pDisplay.DisplayTransformation.TransformCoords(ref WKSPoint, ref tagPOINT, 1, 6);

            pLineSymbol = new SimpleLineSymbolClass();
            //if (pActiveView.FocusMap.MapScale != 0)
            //{
            //    pLineSymbol.Width = WKSPoint.X * 10000 / pActiveView.FocusMap.MapScale;
            //}
            //else
            //{
            //    pLineSymbol.Width = WKSPoint.X / 2;
            //}
            pLineSymbol.Width = WKSPoint.X;

            pRGBColor       = new RgbColorClass();
            pRGBColor.Green = 148; //148
            pRGBColor.Red   = 32;  //32
            pRGBColor.Blue  = 0;

            pSymbol      = pLineSymbol as ISymbol;
            pSymbol.ROP2 = esriRasterOpCode.esriROPNotXOrPen;

            pDisplay.SetSymbol(pSymbol);
            pDisplay.DrawPolyline(pGeometry);
            System.Threading.Thread.Sleep(interval);
            pDisplay.DrawPolyline(pGeometry);
        }
        private static Bitmap GetElementPreviewImage(IHTMLDocument3 doc3, IHTMLElement element, int snapshotWidth, int snapshotHeight)
        {
            try
            {
                // @RIBBON TODO: Need to make this work for RTL as well.
                IDisplayServices displayServices = ((IDisplayServices)doc3);

                element.scrollIntoView(true);

                tagPOINT offset = new tagPOINT();
                offset.x = 0;
                offset.y = 0;
                displayServices.TransformPoint(ref offset, _COORD_SYSTEM.COORD_SYSTEM_CONTENT, _COORD_SYSTEM.COORD_SYSTEM_GLOBAL, element);

                using (Bitmap snapshotAfter = HtmlScreenCaptureCore.TakeSnapshot((IViewObject)doc3, snapshotWidth, snapshotHeight))
                {
                    //snapshotAfter.Save(@"c:\temp\snapshot" + element.id + ".bmp");

                    Rectangle elementRect;
                    elementRect = new Rectangle(Math.Max(2, offset.x), 2, Math.Min(element.offsetWidth, element.offsetParent.offsetWidth), element.offsetHeight);

                    if (element.offsetWidth <= 0 || element.offsetHeight <= 0)
                    {
                        return(null);
                    }

                    Bitmap cropped = ImageHelper2.CropBitmap(snapshotAfter, elementRect);
                    //cropped.Save(@"c:\temp\snapshot" + element.id + ".cropped.bmp");
                    return(cropped);
                }
            }
            catch (Exception ex)
            {
                Trace.Fail("Failed to get element preview image for id " + element.id + ": " + ex);
                return(null);
            }
        }
示例#18
0
 public void trackCustomPopupMenu(WebView sender, int hMenu, ref tagPOINT point)
 {
 }
示例#19
0
 public virtual Int32 GetSize(Int32 dwFlags, tagSIZE sizeContent, tagPOINT pptTranslateBy, tagPOINT pptTopLeft, tagSIZE psizeProposed)
 {
     return(InvokerService.InvokeInternal.ExecuteInt32MethodGet(this, "GetSize", new object[] { dwFlags, sizeContent, pptTranslateBy, pptTopLeft, psizeProposed }));
 }
示例#20
0
 public void ShowContextMenu(uint dwID, ref tagPOINT ppt, object pcmdtReserved, object pdispReserved)
 {
 }
 public void ShowContextMenu(uint dwID, ref tagPOINT ppt, object pcmdtReserved, object pdispReserved)
 {
 }
 public static extern IntPtr SendMessage(HandleRef hWnd, uint msg,
     IntPtr wParam, ref tagPOINT lParam);
示例#23
0
 private void uiAutomationCheck(Point p)
 {
     tagPOINT reference = new tagPOINT();
     reference.x = p.X;
     reference.y = p.Y;
     try
     {
         IUIAutomationElement focus = this.automator.ElementFromPoint(reference);
         System.Diagnostics.Debug.Print(focus.CurrentControlType.ToString());
         System.Diagnostics.Debug.Print("localized:" + focus.CurrentLocalizedControlType);
         if ((focus.CurrentControlType == 50037 && this.parameters.contextValues.supportTitleBars)
             || (focus.CurrentControlType == 50027 && this.parameters.contextValues.supportScrollBars)
             || (focus.CurrentControlType == 50018 && this.parameters.contextValues.supportTabs))
         {
             if (this.status.getCurrentMode() != ProgramMode.clickAndDrag)
             {
                 this.status.setCurrentMode(ProgramMode.clickAndDrag);
             }
         }
     }
     catch (COMException e)
     {
         // No element given, give up
     }
 }
示例#24
0
 public IDataObject willPerformDragSourceAction(WebView WebView, WebDragSourceAction action, ref tagPOINT point, IDataObject pasteboard)
 {
     throw new NotImplementedException();
 }
示例#25
0
 public WebDragSourceAction dragSourceActionMaskForPoint(WebView WebView, ref tagPOINT point)
 {
     throw new NotImplementedException();
 }
示例#26
0
 public WebDragSourceAction dragSourceActionMaskForPoint(WebView WebView, ref tagPOINT point)
 {
     Node e = owner.ElementAtPoint(new Point(point.x, point.y));
     if (e.Type == ElementType.Image)
         return WebDragSourceAction.WebDragSourceActionImage;
     else if (e.Type == ElementType.LinkOrUknown)
         return WebDragSourceAction.WebDragSourceActionLink;
     else if (!string.IsNullOrEmpty(owner.SelectedText))
         return WebDragSourceAction.WebDragSourceActionSelection;
     else
         return WebDragSourceAction.WebDragSourceActionAny;
 }
 public void ShowContextMenu(uint dwID, ref tagPOINT ppt, object pcmdtReserved, object pdispReserved)
 {
     // TODO: is this okay?
     throw new NotImplementedException();
 }
示例#28
0
 public TextRange RangeFromPoint(tagPOINT pt)
 {
     return(new TextRange(this.Pattern.RangeFromPoint(pt), this));
 }
示例#29
0
 public IDataObject willPerformDragSourceAction(WebView WebView, WebDragSourceAction action, ref tagPOINT point, IDataObject pasteboard)
 {
     return null;
 }
示例#30
0
        public Node ElementAtPoint(System.Drawing.Point point)
        {
            tagPOINT p = new tagPOINT();
            p.x = point.X;
            p.y = point.Y;
            object el;

            WebView.elementAtPoint(ref p).RemoteRead("WebElementDOMNodeKey", out el, null, 0, null);
            return Node.Create(el as IDOMNode);   
          
        }
示例#31
0
 public WebDragSourceAction dragSourceActionMaskForPoint(WebView WebView, ref tagPOINT point)
 {
     return WebDragSourceAction.WebDragSourceActionNone;
 }
示例#32
0
 public void CopyLink()
 {
     tagPOINT p = new tagPOINT();
     Point labelOrigin = new Point(0, 0); // this is referencing the control
     Point screenOrigin = PointToScreen(labelOrigin); // this references
     p.x = Cursor.Position.X - screenOrigin.X;
     p.y = Cursor.Position.Y - screenOrigin.Y;
     object el;
     WebView.elementAtPoint(ref p).RemoteRead("WebElementLinkURLKey", out el, null, 0, null);
     if (!String.IsNullOrEmpty((string)el))
         Clipboard.SetText((string)el);
 }
 public static extern bool GetCursorPos(out tagPOINT pPoint);
 public void trackCustomPopupMenu(WebView sender, int hMenu, ref tagPOINT point)
 {
 }
示例#35
0
 int IDocHostShowUI.ShowHelp(IntPtr hwnd, string pszHelpFile, uint uCommand, uint dwData, tagPOINT ptMouse, object pDispatchObjectHit)
 {
     return(Hresults.E_NOTIMPL);
 }
示例#36
0
 public void ShowContextMenu(uint dwID, ref tagPOINT ppt, object pcmdtReserved, object pdispReserved)
 {
     //throw new COMException("", 1); // HRESULT = S_FALSE: MSHTML will show its menu
 }
示例#37
0
 public Element GetCurrentElement()
 {
     if (_el != null)
     {
         Node nd = Node.Create(_el);
         if (nd is Element)
             return (Element)nd;
         else
             nd.Dispose();
         return null;
     }
     else
     {
         tagPOINT point = new tagPOINT() { x = Cursor.Position.X, y = Cursor.Position.Y };
         CFDictionaryPropertyBag elementinfo = webView.elementAtPoint(point);
         object el = null;
         elementinfo.RemoteRead("WebElementDOMNodeKey", out el, null, 0, null);
         if (el == null)
             return null;
         Marshal.ReleaseComObject(elementinfo);
         elementinfo = null;
         Node nd = Element.Create(el as IDOMNode);
         if (nd is Element)
             return (Element)nd;
         else
             return null;
     }
 }
示例#38
0
 public static extern IntPtr SendMessage(HandleRef hWnd, uint msg,
                                         IntPtr wParam, ref tagPOINT lParam);
 public WebDragSourceAction dragSourceActionMaskForPoint(WebView WebView, ref tagPOINT point)
 {
     throw new NotImplementedException();
 }
示例#40
0
 public static extern int MapWindowPoints(IntPtr hWndFrom, IntPtr hWndTo,
                                          [In, Out] tagPOINT pt, int cPoints);
 public IDataObject willPerformDragSourceAction(WebView WebView, WebDragSourceAction action, ref tagPOINT point, IDataObject pasteboard)
 {
     throw new NotImplementedException();
 }
示例#42
0
 public virtual Int32 GetPosition(Int32 lFlags, tagPOINT pptTopLeft)
 {
     return(InvokerService.InvokeInternal.ExecuteInt32MethodGet(this, "GetPosition", lFlags, pptTopLeft));
 }