public override void OnDraw(Graphics g, Rectangle drawBounds, RECT rcBounds, RECT rcUpdate, int lDrawFlags, IntPtr hdc, IntPtr pvDrawObject)
        {
            IHTMLElement2 element2 = HTMLElement as IHTMLElement2;
            //g.DrawRectangle(new Pen(Color.Red, 1), GetPaintRectangle(GetClientRectangle(ELEMENT_REGION.CONTENT), rcBounds));
            //g.DrawRectangle(new Pen(Color.Orange, 1), GetPaintRectangle(GetClientRectangle(ELEMENT_REGION.BORDER), rcBounds));
            //g.DrawRectangle(new Pen(Color.Blue, 1), GetPaintRectangle(GetClientRectangle(ELEMENT_REGION.PADDING), rcBounds));
            //g.DrawRectangle(new Pen(Color.Gold, 1), GetPaintRectangle(GetClientRectangle(ELEMENT_REGION.MARGIN), rcBounds));

            //highlight the line that the caret is currently placed on.
            //Rectangle lineRect = GetPaintRectangle(GetLineClientRectangle(EditorContext.SelectedMarkupRange.Start), rcBounds);
            //g.DrawRectangle(new Pen(Color.Violet, 1), lineRect);
        }
        private const int BORDER_MARGIN_Y = 3; //padding for the border drawn around the region.

        public override void OnDraw(Graphics g, Rectangle drawBounds, RECT rcBounds, RECT rcUpdate, int lDrawFlags, IntPtr hdc, IntPtr pvDrawObject)
        {
            base.OnDraw(g, drawBounds, rcBounds, rcUpdate, lDrawFlags, hdc, pvDrawObject);

            if (RegionBorderVisible)
            {
                //Create region around content region of the element, and add a little padding
                Rectangle bounds = GetPaintRectangle(GetClientRectangle(ELEMENT_REGION.CONTENT), rcBounds);
                int heightPadding = BORDER_MARGIN_Y;
                int widthPadding = BORDER_MARGIN_X;
                bounds.X -= widthPadding;
                bounds.Y -= heightPadding;
                bounds.Width += widthPadding * 2;
                bounds.Height += heightPadding * 2;

                Rectangle borderRectangle = bounds;
                ControlHelper.DrawRoundedRectangle(g, Pens.Gray, borderRectangle, 2);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Convert a .NET rectangle structure into a Win32 RECT structure
 /// </summary>
 /// <param name="rect">rect to convert</param>
 /// <returns>converted rect</returns>
 public static RECT Convert(Rectangle rect)
 {
     RECT newRect = new RECT();
     newRect.left = rect.Left;
     newRect.top = rect.Top;
     newRect.right = rect.Right;
     newRect.bottom = rect.Bottom;
     return newRect;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Convert a Win32 RECT structure into a .NET rectangle
 /// </summary>
 /// <param name="rect"></param>
 /// <returns></returns>
 public static Rectangle Convert(RECT rect)
 {
     return new Rectangle(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
 }
Ejemplo n.º 5
0
 public static extern bool InvalidateRect(
     IntPtr hWnd,           // handle to window
     ref RECT lpRect,  // rectangle coordinates
                       //IntPtr lpRect,
     bool bErase          // erase state
     );
Ejemplo n.º 6
0
 public static extern uint GetBoundsRect(IntPtr hdc, out RECT lprcBounds, uint flags);
Ejemplo n.º 7
0
 public static extern int DrawTextEx(IntPtr hdc, StringBuilder lpchText, int cchText,
     ref RECT lprc, DT dwDTFormat, ref DRAWTEXTPARAMS lpDTParams);
Ejemplo n.º 8
0
 public static extern Boolean GetWindowRect(IntPtr hWnd, ref RECT lpRect);
Ejemplo n.º 9
0
 public static extern Int32 DrawThemeBackground(IntPtr hTheme,
                                                 IntPtr hdc,
                                                 Int32 iPartId,
                                                 Int32 iStateId,
                                                 ref RECT pRect,
                                                 ref RECT pClipRect);
 /// <summary>
 /// IHTMLPainter.Draw -- Called by MSHTML to render a behavior in the browser's client area
 /// </summary>
 /// <param name="rcBounds">RECT that specifies the bounds of the element to which the behavior is attached</param>
 /// <param name="rcUpdate">RECT that specifies a bounding rectangle for the region that needs to be redrawn</param>
 /// <param name="lDrawFlags">HTML_PAINT_DRAW_FLAGS enumeration that specifies options to use while drawing</param>
 /// <param name="hdc">HDC that specifies a Microsoft® Windows® Graphics Device Interface (GDI) device context for the behavior to use while drawing</param>
 /// <param name="pvDrawObject">Pointer to a drawing object, such as a Microsoft DirectDraw® surface, for the behavior to use while drawing</param>
 public virtual void Draw(RECT rcBounds, RECT rcUpdate, int lDrawFlags, IntPtr hdc, IntPtr pvDrawObject)
 {
 }
 public virtual void ResizeBorder(ref RECT prcBorder, IOleInPlaceUIWindow pUIWindow, bool frameWindow)
 {
 }