fix: #45 File dialog controls misalign when the screen is zoomed
This commit is contained in:
@@ -167,7 +167,13 @@ BOOL Run(const char* argv1, int argv2) {
|
||||
stop = hDll ? StopRun(GetProcAddress(hDll, "StopRun")) : NULL;
|
||||
bStop = hDll ? IsStoped(GetProcAddress(hDll, "IsStoped")) : NULL;
|
||||
bExit = hDll ? IsExit(GetProcAddress(hDll, "IsExit")) : NULL;
|
||||
if (run)
|
||||
if (NULL == run) {
|
||||
if (hDll) FreeLibrary(hDll);
|
||||
Mprintf("<EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"ʧ<EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n", GetLastError());
|
||||
Sleep(3000);
|
||||
return FALSE;
|
||||
}
|
||||
do
|
||||
{
|
||||
char ip[_MAX_PATH];
|
||||
strcpy_s(ip, g_ConnectAddress.ServerIP());
|
||||
@@ -194,16 +200,12 @@ BOOL Run(const char* argv1, int argv2) {
|
||||
if (bExit) {
|
||||
result = bExit();
|
||||
}
|
||||
if (!FreeLibrary(hDll)) {
|
||||
Mprintf("<EFBFBD>ͷŶ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"ʧ<EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n", GetLastError());
|
||||
}
|
||||
else {
|
||||
Mprintf("<EFBFBD>ͷŶ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"<EFBFBD>ɹ<EFBFBD>!\n");
|
||||
}
|
||||
} while (result == 2);
|
||||
if (!FreeLibrary(hDll)) {
|
||||
Mprintf("<EFBFBD>ͷŶ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"ʧ<EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n", GetLastError());
|
||||
}
|
||||
else {
|
||||
Mprintf("<EFBFBD><EFBFBD><EFBFBD>ض<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"ʧ<EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>: %d\n", GetLastError());
|
||||
Sleep(3000);
|
||||
Mprintf("<EFBFBD>ͷŶ<EFBFBD>̬<EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>\"ServerDll.dll\"<EFBFBD>ɹ<EFBFBD>!\n");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -26,10 +26,19 @@ typedef struct {
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CFileManagerDlg dialog
|
||||
|
||||
float GetScreenScalingFactor() {
|
||||
HDC hdc = GetDC(NULL); // <20><>ȡ<EFBFBD><C8A1>Ļ<EFBFBD>豸<EFBFBD><E8B1B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int dpiX = GetDeviceCaps(hdc, LOGPIXELSX); // <20><>ȡˮƽ DPI
|
||||
ReleaseDC(NULL, hdc);
|
||||
|
||||
// <20><><EFBFBD>ű<EFBFBD><C5B1><EFBFBD> = DPI / <20><> DPI<50><49>96<39><36>
|
||||
return dpiX / 96.0f;
|
||||
}
|
||||
|
||||
CFileManagerDlg::CFileManagerDlg(CWnd* pParent, CIOCPServer* pIOCPServer, ClientContext *pContext)
|
||||
: CDialog(CFileManagerDlg::IDD, pParent)
|
||||
{
|
||||
m_fScalingFactor = GetScreenScalingFactor();
|
||||
//{{AFX_DATA_INIT(CFileManagerDlg)
|
||||
//}}AFX_DATA_INIT
|
||||
m_bIsClosed = false;
|
||||
@@ -245,9 +254,7 @@ BOOL CFileManagerDlg::OnInitDialog()
|
||||
m_wndToolBar_Remote.AddDropDownButton(this, IDT_REMOTE_VIEW, IDR_REMOTE_VIEW);
|
||||
|
||||
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
m_wndToolBar_Local.MoveWindow(268, 0, rect.right - 268, 48);
|
||||
m_wndToolBar_Remote.MoveWindow(268, rect.bottom / 2 - 10, rect.right - 268, 48);
|
||||
|
||||
UpdateWindowsPos();
|
||||
|
||||
// <20><><EFBFBD>ñ<EFBFBD><C3B1><EFBFBD>
|
||||
CString str;
|
||||
@@ -305,15 +312,24 @@ void CFileManagerDlg::OnSize(UINT nType, int cx, int cy)
|
||||
m_wndStatusBar.GetItemRect(1, &rect);
|
||||
m_ProgressCtrl->MoveWindow(&rect);
|
||||
|
||||
UpdateWindowsPos();
|
||||
}
|
||||
|
||||
void CFileManagerDlg::UpdateWindowsPos() {
|
||||
RECT rect;
|
||||
GetClientRect(&rect);
|
||||
int cx = rect.right - rect.left;
|
||||
int cy = rect.bottom - rect.top;
|
||||
GetDlgItem(IDC_LIST_LOCAL)->MoveWindow(0, 36, cx, (cy - 100) / 2);
|
||||
GetDlgItem(IDC_LIST_REMOTE)->MoveWindow(0, (cy / 2) + 28, cx, (cy - 100) / 2);
|
||||
GetDlgItem(IDC_STATIC_REMOTE)->MoveWindow(20, cy / 2, 25, 20);
|
||||
GetDlgItem(IDC_REMOTE_PATH)->MoveWindow(53, (cy / 2) - 4 , 210, 12);
|
||||
GetDlgItem(IDC_STATIC_LOCAL)->MoveWindow(10, 10, 25 * m_fScalingFactor, 20);
|
||||
GetDlgItem(IDC_STATIC_REMOTE)->MoveWindow(10, cy / 2, 25 * m_fScalingFactor, 20);
|
||||
GetDlgItem(IDC_LOCAL_PATH)->MoveWindow(56, 5, 210, 12);
|
||||
GetDlgItem(IDC_REMOTE_PATH)->MoveWindow(56, (cy / 2) - 4, 210, 12);
|
||||
|
||||
GetClientRect(&rect);
|
||||
//<2F><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
m_wndToolBar_Local.MoveWindow(268, 0, rect.right - 268, 48);
|
||||
m_wndToolBar_Remote.MoveWindow(268, rect.bottom / 2 - 10, rect.right - 268, 48);
|
||||
m_wndToolBar_Local.MoveWindow(268, 0, (rect.right - 268), 48);
|
||||
m_wndToolBar_Remote.MoveWindow(268, (rect.bottom / 2 - 10), (rect.right - 268), 48);
|
||||
}
|
||||
|
||||
void CFileManagerDlg::FixedLocalDriveList()
|
||||
|
||||
@@ -75,6 +75,7 @@ public:
|
||||
BOOL SendDownloadJob();
|
||||
BOOL SendUploadJob();
|
||||
BOOL SendDeleteJob();
|
||||
void UpdateWindowsPos();
|
||||
|
||||
strList m_Remote_Download_Job;
|
||||
strList m_Remote_Upload_Job;
|
||||
@@ -213,6 +214,7 @@ private:
|
||||
void EndLocalUploadFile();
|
||||
bool DeleteDirectory(LPCTSTR lpszDirectory);
|
||||
void EnableControl(BOOL bEnable = TRUE);
|
||||
float m_fScalingFactor;
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user