コード例 #1
0
        /// <summary>
        /// Constructs a new <see cref="ControlPointsGraphic"/> to control the given subject graphic.
        /// </summary>
        /// <param name="subject">The graphic to control.</param>
        public ControlPointsGraphic(IGraphic subject)
            : base(subject)
        {
            _stretchingToken = new CursorToken(CursorToken.SystemCursors.Cross);

            Initialize();
        }
コード例 #2
0
        public static CursorWrapper CreateCursor(CursorToken cursorToken)
        {
            if (cursorToken.IsSystemCursor)
            {
                return(new CursorWrapper(GetSystemCursor(cursorToken.ResourceName), false));
            }

            if (cursorToken.ResourceName.EndsWith(".cur", StringComparison.InvariantCultureIgnoreCase))
            {
                return(FromCursorResource(cursorToken.ResourceName, cursorToken.Resolver));
            }

            return(FromImageResource(cursorToken.ResourceName, cursorToken.Resolver));
        }
コード例 #3
0
        public Rotate3DTool()
            : base(SR.TooltipRotate3D)
        {
            CursorToken = new CursorToken("Icons.Rotate3DToolSmall.png", GetType().Assembly);
            _operation  = new SpatialTransform3DImageOperation(Apply);

            const string graphicName = "Icons.NoSpineLabeling.png";
            var          iconSet     = new UnavailableActionIconSet(new IconSet("Icons.Rotate3DToolSmall.png", "Icons.Rotate3DToolMedium.png", "Icons.Rotate3DToolLarge.png"));
            var          resolver    = new ApplicationThemeResourceResolver(GetType(), false);

            _flashOverlayController = new FlashOverlayController(iconSet, resolver)
            {
                FlashSpeed = 1500
            };
        }
コード例 #4
0
        /// <summary>
        /// Gets the cursor token to be shown at the current mouse position.
        /// </summary>
        /// <remarks>
        /// The <see cref="ControlGraphic"/> implementation returns the the cursor token
        /// provided by the current input handler, <see cref="GetCursorToken"/>, or any
        /// child graphics implementing <see cref="ICursorTokenProvider"/>,
        /// in decreasing order of priority.
        /// </remarks>
        CursorToken ICursorTokenProvider.GetCursorToken(Point point)
        {
            // TODO (CR Oct 2011): This pattern could be reused outside the context
            // of a "Control" graphic. Perhaps we could move it out to a "GraphicsController"
            // class that enumerates through a list of graphics looking for a handler.
            CursorToken cursor = null;

            if (_capturedHandler != null)
            {
                var provider = _capturedHandler as ICursorTokenProvider;
                if (provider != null)
                {
                    cursor = (provider).GetCursorToken(point);
                }
            }

            if (Enabled && cursor == null)
            {
                cursor = GetCursorToken(point);
            }

            if (cursor == null)
            {
                foreach (IGraphic graphic in EnumerateChildGraphics(true))
                {
                    if (!graphic.Visible)
                    {
                        continue;
                    }

                    ICursorTokenProvider provider = graphic as ICursorTokenProvider;
                    if (provider != null)
                    {
                        cursor = provider.GetCursorToken(point);
                        if (cursor != null)
                        {
                            break;
                        }
                    }
                }
            }

            return(cursor);
        }
コード例 #5
0
        /// <summary>
        /// Constructs a new <see cref="AnchorPointControlGraphic"/>.
        /// </summary>
        /// <param name="subject">An <see cref="IPointGraphic"/> or an <see cref="IControlGraphic"/> chain whose subject is an <see cref="IPointGraphic"/>.</param>
        public AnchorPointControlGraphic(IGraphic subject)
            : base(subject)
        {
            Platform.CheckExpectedType(base.Subject, typeof(IPointGraphic));

            _moveCursor = new CursorToken(CursorToken.SystemCursors.SizeAll);

            this.CoordinateSystem = CoordinateSystem.Source;
            try
            {
                base.ControlPoints.Add(this.Subject.Point);
            }
            finally
            {
                this.ResetCoordinateSystem();
            }

            Initialize();
        }
コード例 #6
0
        private Cursor CreateCursor()
        {
            CursorToken token = _tileController.CursorToken;

            if (token == null)
            {
                return(null);
            }

            Cursor webCursor = new Cursor();
            Bitmap bitmap;

            if (token.IsSystemCursor)
            {
                PropertyInfo propertyInfo = typeof(Cursors).GetProperty(token.ResourceName, BindingFlags.Static | BindingFlags.Public);
                var          cursor       = (System.Windows.Forms.Cursor)propertyInfo.GetValue(null, null);
                bitmap = new Bitmap(cursor.Size.Width, cursor.Size.Height, PixelFormat.Format32bppArgb);
                using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bitmap))
                    cursor.Draw(g, new Rectangle(Point.Empty, cursor.Size));

                webCursor.HotSpot = new Position(cursor.HotSpot);
            }
            else
            {
                bitmap            = new Bitmap(token.Resolver.OpenResource(token.ResourceName));
                webCursor.HotSpot = new Position {
                    X = bitmap.Width / 2, Y = bitmap.Height / 2
                };
            }

            using (MemoryStream stream = new MemoryStream())
            {
                bitmap.Save(stream, ImageFormat.Png);
                stream.Position = 0;

                webCursor.Icon = stream.GetBuffer();
                stream.Close();
            }

            return(webCursor);
        }
コード例 #7
0
 public StackTool()
     : base(SR.TooltipStack)
 {
     CursorToken = new CursorToken("Icons.StackToolSmall.png", GetType().Assembly);
 }
コード例 #8
0
		public static CursorWrapper CreateCursor(CursorToken cursorToken)
		{
			if (cursorToken.IsSystemCursor)
				return new CursorWrapper(GetSystemCursor(cursorToken.ResourceName), false);

			if (cursorToken.ResourceName.EndsWith(".cur", StringComparison.InvariantCultureIgnoreCase))
				return FromCursorResource(cursorToken.ResourceName, cursorToken.Resolver);

			return FromImageResource(cursorToken.ResourceName, cursorToken.Resolver);
		}
コード例 #9
0
 public WindowLevelTool()
     : base(SR.TooltipWindowLevel)
 {
     CursorToken = new CursorToken("Icons.WindowLevelToolSmall.png", GetType().Assembly);
     _operation  = new VoiLutImageOperation(Apply);
 }
コード例 #10
0
 /// <summary>
 /// Constructs a new instance of <see cref="MoveControlGraphic"/>.
 /// </summary>
 /// <param name="subject">The subject graphic.</param>
 public MoveControlGraphic(IGraphic subject) : base(subject)
 {
     _cursor = new CursorToken(CursorToken.SystemCursors.SizeAll);
 }
コード例 #11
0
 /// <summary>
 /// Default constructor.  A no-args constructor is required by the
 /// framework.  Do not remove.
 /// </summary>
 public ProbeTool()
     : base(SR.TooltipProbe)
 {
     CursorToken = new CursorToken("ProbeCursor.png", this.GetType().Assembly);
     Behaviour  |= MouseButtonHandlerBehaviour.ConstrainToTile;
 }
コード例 #12
0
ファイル: PanTool.cs プロジェクト: ronmark1/ClearCanvas-1
 public PanTool()
     : base(SR.TooltipPan)
 {
     CursorToken = new CursorToken("Icons.PanToolSmall.png", GetType().Assembly);
     _operation  = new SpatialTransformImageOperation(Apply);
 }