From 52b9108428c2a6dc779dff25bb8e1832bf4dbc8b Mon Sep 17 00:00:00 2001 From: fanlusky <1730976608@qq.com> Date: Tue, 16 Jun 2026 18:24:25 +0800 Subject: [PATCH] Fix centered layout for demo header --- ui/README.md | 1 + ui/demos/msimeui-demo/DemoScene.cpp | 14 ++++++-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/ui/README.md b/ui/README.md index 231a49ab..2efb251e 100644 --- a/ui/README.md +++ b/ui/README.md @@ -70,6 +70,7 @@ - 移除了 demo 中 `Accordion` 示例的固定高度,避免多项同时展开后内容文本被裁切和溢出 - 微调了多行 `TextBox` 的水平文字内边距,让大尺寸编辑区中的光标和首行文本不会显得过于贴近左边框 - 将 demo 顶部的 `msimeui` 标题和副标题改为居中展示,并把标题上方留白收窄到原来的一半 +- 修正了 demo 顶部标题区的居中方式:改为通过独立 header 容器居中内容,确保 `msimeui` 标题和描述文本在页面顶部真正水平居中 ## 构建 diff --git a/ui/demos/msimeui-demo/DemoScene.cpp b/ui/demos/msimeui-demo/DemoScene.cpp index 71de1b34..e5f371d4 100644 --- a/ui/demos/msimeui-demo/DemoScene.cpp +++ b/ui/demos/msimeui-demo/DemoScene.cpp @@ -10,15 +10,13 @@ std::unique_ptr CreateDemoScene() { auto root = std::make_shared(0.0f); root->AddChild(std::make_shared(14.0f)); - auto appTitle = std::make_shared(L"msimeui", 34.0f, D2D1::ColorF(0x111827), true); - appTitle->SetHorizontalAlignment(HorizontalAlignment::Center); - root->AddChild(appTitle); - root->AddChild(std::make_shared(12.0f)); - auto appSubtitle = + auto appHeader = std::make_shared(12.0f); + appHeader->SetHorizontalContentAlignment(HorizontalAlignment::Center); + appHeader->AddChild(std::make_shared(L"msimeui", 34.0f, D2D1::ColorF(0x111827), true)); + appHeader->AddChild( std::make_shared(L"A retained-mode Win32 GUI framework with Direct2D / DirectWrite and in-tree TSF.", - 16.0f, D2D1::ColorF(0x5B6472)); - appSubtitle->SetHorizontalAlignment(HorizontalAlignment::Center); - root->AddChild(appSubtitle); + 16.0f, D2D1::ColorF(0x5B6472))); + root->AddChild(appHeader); root->AddChild(std::make_shared(36.0f)); Brush surface;