From f417ccc9ef95d8437929d62f5411a74b673131d4 Mon Sep 17 00:00:00 2001 From: Nomango Date: Fri, 7 Sep 2018 18:00:56 +0800 Subject: [PATCH] optimize: Code style --- core/e2dmodule.h | 2 +- core/modules/Window.cpp | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/core/e2dmodule.h b/core/e2dmodule.h index 443f253a..5a58822b 100644 --- a/core/e2dmodule.h +++ b/core/e2dmodule.h @@ -71,7 +71,7 @@ namespace e2d // 设置窗体图标 void SetIcon( - int icon_id /* 图标资源 ID */ + int resource_id /* 图标资源 ID */ ); // 设置鼠标指针样式 diff --git a/core/modules/Window.cpp b/core/modules/Window.cpp index cb3b58a8..feac6dd6 100644 --- a/core/modules/Window.cpp +++ b/core/modules/Window.cpp @@ -237,15 +237,22 @@ void e2d::Window::SetTitle(const String& title) } } -void e2d::Window::SetIcon(int icon_id) +void e2d::Window::SetIcon(int resource_id) { - this->icon_id_ = icon_id; + this->icon_id_ = resource_id; if (hWnd_) { - HICON hIcon = (HICON)::LoadImage(HINST_THISCOMPONENT, MAKEINTRESOURCE(icon_id), IMAGE_ICON, 0, 0, LR_DEFAULTCOLOR | LR_CREATEDIBSECTION | LR_DEFAULTSIZE); + HICON icon = (HICON)::LoadImage( + HINST_THISCOMPONENT, + MAKEINTRESOURCE(resource_id), + IMAGE_ICON, + 0, + 0, + LR_DEFAULTCOLOR | LR_CREATEDIBSECTION | LR_DEFAULTSIZE + ); // 设置窗口的图标 - ::SendMessage(hWnd_, WM_SETICON, ICON_BIG, (LPARAM)hIcon); - ::SendMessage(hWnd_, WM_SETICON, ICON_SMALL, (LPARAM)hIcon); + ::SendMessage(hWnd_, WM_SETICON, ICON_BIG, (LPARAM)icon); + ::SendMessage(hWnd_, WM_SETICON, ICON_SMALL, (LPARAM)icon); } }