示例#1
0
        /// <summary>
        /// Called when an element should be painted. (Invoked from CefRenderHandler.OnPaint)
        /// </summary>
        /// <param name="type">indicates whether the element is the view or the popup widget.</param>
        /// <param name="dirtyRect">contains the set of rectangles in pixel coordinates that need to be repainted</param>
        /// <param name="buffer">The bitmap will be will be  width * height *4 bytes in size and represents a BGRA image with an upper-left origin</param>
        /// <param name="width">width</param>
        /// <param name="height">height</param>
        void IRenderWebBrowser.OnPaint(PaintElementType type, Rect dirtyRect, IntPtr buffer, int width, int height)
        {
            var handled = false;

            var args = new OnPaintEventArgs(type == PaintElementType.Popup, dirtyRect, buffer, width, height);

            var handler = Paint;

            if (handler != null)
            {
                handler(this, args);
                handled = args.Handled;
            }

            if (!handled)
            {
                _renderTarget.OnPaint(type == PaintElementType.View, buffer, width, height);
            }
        }