You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

ImGUI菜单栏未显示问题排查:窗口弹出但菜单栏不出现

菜单栏未显示的问题修复

你代码里的问题是调用ImGui::BeginMenu("Menu")后缺少对应的ImGui::EndMenu(),ImGui的菜单组件要求每个BeginMenu必须和EndMenu配对使用,否则UI层级会错乱,导致菜单栏无法正常渲染。

修复后的代码如下:

ImGui::Begin("Example Window");

// Create a menu bar
if (ImGui::BeginMenuBar())
{
    if (ImGui::BeginMenu("Menu"))
    {
        ImGui::MenuItem("Console");
        ImGui::EndMenu(); // 新增这行,闭合Menu
    }

    ImGui::EndMenuBar();
}
ImGui::End();

内容的提问来源于stack exchange,提问作者Zak

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.02 19:02:03