gpt4 book ai didi

c++ - 单击按钮时如何更改光标

转载 作者:太空宇宙 更新时间:2023-11-04 13:26:47 25 4
gpt4 key购买 nike

我正在使用 Visual Studio 2008 开发 C++ MFC 应用程序。我的 UI 中有一个按钮,当用户单击该按钮时,我想将鼠标指针更改为平移手。我该怎么做?

最佳答案

使用SetCursor() .单击按钮时,将 bool m_bHand 设置为 true。

在 OnMouseMove() 中...

if (m_bHand == true)
{
SetCursor(::LoadCursor(NULL, IDC_HAND));
}
else
{
SetCursor(::LoadCursor(NULL, IDC_ARROW));
}

LoadCursor的第二个参数可以是你自己的ico资源ID。

希望这对您有所帮助。 :-)

关于c++ - 单击按钮时如何更改光标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33074017/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com