gpt4 book ai didi

C++ Windows API : disabled menu grayed?

转载 作者:可可西里 更新时间:2023-11-01 12:48:23 24 4
gpt4 key购买 nike

<分区>

我正在测试 Windows API 的菜单状态(禁用、变灰、选中...),但有些东西我不明白。 documentation指出 MF_DISABLED 不会使项目变灰,但这是我得到的:

enter image description here

使用此代码:

HMENU menuBar = CreateMenu();
HMENU hopMenu = CreateMenu();

AppendMenuW(menuBar, MF_POPUP, (UINT_PTR)hopMenu, L"hop");
AppendMenuW(hopMenu, MF_STRING, 0, L"Enabled");

AppendMenuW(hopMenu, MF_STRING | MF_DISABLED, 1, L"Disabled");
AppendMenuW(hopMenu, MF_STRING | MF_GRAYED, 2, L"Grayed");
AppendMenuW(hopMenu, MF_STRING | MF_CHECKED, 3, L"Checked");

AppendMenuW(hopMenu, MF_STRING | MF_DISABLED | MF_CHECKED, 4, L"Disabled && Checked");
AppendMenuW(hopMenu, MF_STRING | MF_DISABLED | MF_GRAYED, 5, L"Disabled && Grayed");

AppendMenuW(hopMenu, MF_STRING | MF_CHECKED | MF_GRAYED, 6, L"Checked && Grayed");

SetMenu(hwnd, menuBar);

我怎样才能让一个禁用的菜单项不变灰呢?

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