■ 커서를 표시하거나 숨기는 방법을 보여준다.
▶ CursorHelper.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
using System.Runtime.InteropServices; namespace TestProject { /// <summary> /// 커서 헬퍼 /// </summary> public static class CursorHelper { //////////////////////////////////////////////////////////////////////////////////////////////////// Import ////////////////////////////////////////////////////////////////////////////////////////// Static //////////////////////////////////////////////////////////////////////////////// Private #region 커서 보여주기 - ShowCursor(show) /// <summary> /// 커서 보여주기 /// </summary> /// <param name="show">표시 여부</param> /// <returns>디스플레이 카운트</returns> [DllImport("user32")] private static extern int ShowCursor(bool show); #endregion //////////////////////////////////////////////////////////////////////////////////////////////////// Method ////////////////////////////////////////////////////////////////////////////////////////// Static //////////////////////////////////////////////////////////////////////////////// Public #region 커서 보여주기 - ShowCursor() /// <summary> /// 커서 보여주기 /// </summary> public static void ShowCursor() { while(ShowCursor(true) < 0) { ShowCursor(true); } } #endregion #region 커서 숨기기 - HideCursor() /// <summary> /// 커서 숨기기 /// </summary> public static void HideCursor() { while(ShowCursor(false) >= 0) { ShowCursor(false); } } #endregion } } |