Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update UIBase.cpp #169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 25 additions & 5 deletions DuiLib/Core/UIBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ bool CNotifyPump::LoopDispatch(TNotifyUI& msg)

void CNotifyPump::NotifyPump(TNotifyUI& msg)
{
///�������ⴰ��
///遍历虚拟窗口
if( !msg.sVirtualWnd.IsEmpty() ){
for( int i = 0; i< m_VirtualWndMap.GetSize(); i++ ) {
if( LPCTSTR key = m_VirtualWndMap.GetAt(i) ) {
Expand All @@ -207,7 +207,7 @@ void CNotifyPump::NotifyPump(TNotifyUI& msg)
}

///
//����������
//遍历主窗口
LoopDispatch( msg );
}

Expand Down Expand Up @@ -371,7 +371,7 @@ void CWindowWnd::CenterWindow()
if (hWndCenter!=NULL)
hWnd=hWndCenter;

// ��������ʾ��ģʽ����Ļ����
// 处理多显示器模式下屏幕居中
MONITORINFO oMonitor = {};
oMonitor.cbSize = sizeof(oMonitor);
::GetMonitorInfo(::MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST), &oMonitor);
Expand Down Expand Up @@ -400,18 +400,38 @@ void CWindowWnd::CenterWindow()
void CWindowWnd::SetIcon(UINT nRes)
{
HICON hIcon = (HICON)::LoadImage(CPaintManagerUI::GetInstance(), MAKEINTRESOURCE(nRes), IMAGE_ICON,
(::GetSystemMetrics(SM_CXICON) + 15) & ~15, (::GetSystemMetrics(SM_CYICON) + 15) & ~15, // ��ֹ��DPI��ͼ��ģ��
(::GetSystemMetrics(SM_CXICON) + 15) & ~15, (::GetSystemMetrics(SM_CYICON) + 15) & ~15, // 防止高DPI下图标模糊
LR_DEFAULTCOLOR);
ASSERT(hIcon);
::SendMessage(m_hWnd, WM_SETICON, (WPARAM) TRUE, (LPARAM) hIcon);

hIcon = (HICON)::LoadImage(CPaintManagerUI::GetInstance(), MAKEINTRESOURCE(nRes), IMAGE_ICON,
(::GetSystemMetrics(SM_CXICON) + 15) & ~15, (::GetSystemMetrics(SM_CYICON) + 15) & ~15, // ��ֹ��DPI��ͼ��ģ��
(::GetSystemMetrics(SM_CXICON) + 15) & ~15, (::GetSystemMetrics(SM_CYICON) + 15) & ~15, // 防止高DPI下图标模糊
LR_DEFAULTCOLOR);
ASSERT(hIcon);
::SendMessage(m_hWnd, WM_SETICON, (WPARAM) FALSE, (LPARAM) hIcon);
}

void CWindowWnd::SetIcon(LPCTSTR path)
{
HINSTANCE instance = CPaintManagerUI::GetInstance();
int cx = (::GetSystemMetrics(SM_CXICON) + 15) & ~15;
int cy = (::GetSystemMetrics(SM_CYICON) + 15) & ~15;
HICON hIcon = (HICON)::LoadImage(instance, path, IMAGE_ICON,
cx, cy, // 防止高DPI下图标模糊
LR_LOADFROMFILE);
ASSERT(hIcon);
::SendMessage(m_hWnd, WM_SETICON, (WPARAM) TRUE, (LPARAM) hIcon);

cx = (::GetSystemMetrics(SM_CXICON) + 15) & ~15;
cy = (::GetSystemMetrics(SM_CYICON) + 15) & ~15;
hIcon = (HICON)::LoadImage(instance, path, IMAGE_ICON,
cx, cy, // 防止高DPI下图标模糊
LR_LOADFROMFILE);
ASSERT(hIcon);
::SendMessage(m_hWnd, WM_SETICON, (WPARAM) FALSE, (LPARAM) hIcon);
}

bool CWindowWnd::RegisterWindowClass()
{
WNDCLASS wc = { 0 };
Expand Down