【问题标题】:How do I set the "Select Precision" cursor in a C++ application?如何在 C++ 应用程序中设置“选择精度”光标?
【发布时间】:2018-05-25 21:01:51
【问题描述】:

我需要以某种方式将光标设置为 C++ 应用程序的“选择精度”指针(水平和垂直交叉点)。

有人知道如何使用 WinApi 协议进行集成吗?

【问题讨论】:

    标签: c++ winapi mouse-cursor


    【解决方案1】:

    初始化代码中的某处:

    HCURSOR precision_cursor = LoadCursor( NULL, IDC_CROSS );
    

    和窗口程序:

    LRESULT CALLBACK YourWindowProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
    {
        switch ( msg )
        {
        case WM_SETCURSOR:
            // If you omit test below, you will change cursor also for scrollbars, frames, etc.
            if ( LOWORD( lparam ) == HTCLIENT )
            {
                SetCursor( precision_cursor );
                return TRUE;
            }
            break;
        }
    
        // This will also handle cursor for scrollbars and frames.
        return DefWindowProc( hwnd, msg, wparam, lparam );
    }
    

    【讨论】:

      猜你喜欢
      • 2013-09-22
      • 2023-02-13
      • 2011-10-06
      • 2021-11-19
      • 1970-01-01
      • 1970-01-01
      • 2010-09-25
      • 2010-10-02
      • 1970-01-01
      相关资源
      最近更新 更多