public Point TransformGlobalToLocal(Point ptGlobal)
        {
            POINT pointLocal  = new POINT();
            POINT pointGlobal = new POINT();

            pointGlobal.x = ptGlobal.X;
            pointGlobal.y = ptGlobal.Y;
            HTMLPaintSite.TransformGlobalToLocal(pointGlobal, ref pointLocal);
            return(new Point(pointLocal.x, pointLocal.y));
        }
 private void InvalidateControlPadding()
 {
     if (Attached)
     {
         //Warning: force a full invalidation of the current paint area before invalidating
         //the painter info so that we don't accidentally shrink the paintable region before
         //we've had a chance clear everything that was previously painted.
         Invalidate();
         HTMLPaintSite.InvalidatePainterInfo();
     }
 }
Ejemplo n.º 3
0
		private Rectangle CalculateWidgetScreenBounds()
		{
			// translate local location to client location
			POINT localLocation = new POINT();
			localLocation.x = _widgetLocation.X ;
			localLocation.y = _widgetLocation.Y ;
			POINT clientLocation = new POINT();
			HTMLPaintSite.TransformLocalToGlobal(localLocation, ref clientLocation);

			Point screenLocation = EditorContext.PointToScreen(new Point(clientLocation.x, clientLocation.y)) ;
			return new Rectangle(screenLocation, new Size(_widgetArea.Width, _widgetArea.Height) );
		}
Ejemplo n.º 4
0
		private bool ClientPointInWidget( int x, int y )
		{
			// calculate mouse position in local coordinates
			POINT clientMouseLocation = new POINT();
			clientMouseLocation.x = x ;
			clientMouseLocation.y = y ;
			POINT localMouseLocation = new POINT();
			HTMLPaintSite.TransformGlobalToLocal( clientMouseLocation, ref localMouseLocation ) ;

			// is the mouse in the widget?
			return _widgetArea.Contains( localMouseLocation.x, localMouseLocation.y ) ;
		}
        protected void SetPadding(int top, int right, int bottom, int left)
        {
            if (topPadding == top && rightPadding == right && bottomPadding == bottom && leftPadding == left)
            {
                return;
            }

            topPadding    = top;
            rightPadding  = right;
            bottomPadding = bottom;
            leftPadding   = left;
            SynchronizeElementRectangle();
            HTMLPaintSite.InvalidatePainterInfo();
            Invalidate();
        }
        protected Point TranslateClientPointToBounds(Point p)
        {
            // calculate mouse position in local coordinates
            POINT clientMouseLocation = new POINT();

            clientMouseLocation.x = p.X;
            clientMouseLocation.y = p.Y;
            POINT localMouseLocation = new POINT();

            HTMLPaintSite.TransformGlobalToLocal(clientMouseLocation, ref localMouseLocation);

            Point pBounds = new Point(localMouseLocation.x - LeftPadding, localMouseLocation.y - TopPadding);

            return(pBounds);
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Translates a client rectangle into the rectangle defined by the drawing bounds.
        /// </summary>
        /// <param name="clientRectangle"></param>
        /// <param name="rcBounds"></param>
        /// <returns></returns>
        protected Rectangle GetPaintRectangle(Rectangle clientRectangle, RECT rcBounds)
        {
            POINT globalPoint = new POINT();

            globalPoint.x = clientRectangle.Left;
            globalPoint.y = clientRectangle.Top;
            POINT localPoint = new POINT();

            HTMLPaintSite.TransformGlobalToLocal(globalPoint, ref localPoint);

            Rectangle converted = new Rectangle(localPoint.x + rcBounds.left, localPoint.y + rcBounds.top,
                                                clientRectangle.Right - clientRectangle.Left, clientRectangle.Bottom - clientRectangle.Top);

            return(converted);
        }