关于Winform控件调用插入点(光标)的用法

我们自定义控件中可能会有一些光标的使用,比如插入文字和图片提示,下面是调用WIN32 API的光标用法

Winform控件调用插入点的用法

 // 导入处理光标的 Windows 32 位 API
        // 创建光标
        [DllImport("User32.dll")]
        private static extern bool GetCaretPos(ref  MyNativePOINT p);


        // 导入处理光标的 Windows 32 位 API
        // 创建光标
        [DllImport("User32.dll")]
        private static extern bool CreateCaret(IntPtr hWnd, int hBitmap, int nWidth, int nHeight);
        // 设置光标位置
        [DllImport("User32.dll")]
        private static extern bool SetCaretPos(int x, int y);
        // 删除光标
        [DllImport("User32.dll")]
        private static extern bool DestroyCaret();
        // 显示光标
        [DllImport("User32.dll")]
        private static extern bool ShowCaret(IntPtr hWnd);
        // 隐藏光标
        [DllImport("User32.dll")]
        private static extern bool HideCaret(IntPtr hWnd);

 版权所有,请勿转载

posted @ 2016-11-07 16:18  泰兰德爱香蕉  阅读(785)  评论(0编辑  收藏  举报