static Cursor GetCursor (CursorType type, Generator generator = null) { var cache = generator.Cache<CursorType, Cursor> (cursorCache); Cursor cursor; lock (cache) { if (!cache.TryGetValue (type, out cursor)) { cursor = new Cursor (generator, type); cache [type] = cursor; } } return cursor; }
static Cursor GetCursor(CursorType type) { var cache = Platform.Instance.Cache<CursorType, Cursor> (cursorCache); Cursor cursor; lock (cache) { if (!cache.TryGetValue (type, out cursor)) { cursor = new Cursor(type); cache [type] = cursor; } } return cursor; }
protected override void OnMouseMove(MouseEventArgs e) { bool shouldTranslate = (e.Modifiers & ActionModifierKey) != Keys.None; if (shouldTranslate) { if (startDragLocation.IsZero) //on start drag { startDragLocation = e.Location; cursor = this.Cursor; Cursor = Cursors.Pointer; } //on drag imageBounds.X += e.Location.X - startDragLocation.X; imageBounds.Y += e.Location.Y - startDragLocation.Y; startDragLocation = e.Location; this.Invalidate(); } else //on end drag { startDragLocation = PointF.Empty; Cursor = cursor; } base.OnMouseMove(e); }