From 9565d67cbdcb770998723ae0d4ff7b6d308a3953 Mon Sep 17 00:00:00 2001 From: Zhong Yang Date: Sun, 11 Nov 2018 15:09:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=86=E5=8F=B2=E6=B5=81=E9=87=8F=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E4=B8=AD=E5=BD=93=E6=9C=88=E6=80=BB=E6=B5=81=E9=87=8F?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=A2=9E=E5=8A=A0=E4=B8=8A=E4=BC=A0=E5=92=8C?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=B5=81=E9=87=8F=E6=98=BE=E7=A4=BA=EF=BC=9B?= =?UTF-8?q?=E7=B9=81=E4=BD=93=E4=B8=AD=E6=96=87=E7=BF=BB=E8=AF=91=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=EF=BC=9B=E7=89=88=E6=9C=AC=E5=8F=B7=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TrafficMonitor/DrawCommon.cpp | 10 ++++++++-- TrafficMonitor/DrawCommon.h | 2 +- TrafficMonitor/HistoryTrafficCalendarDlg.cpp | Bin 23032 -> 23904 bytes TrafficMonitor/HistoryTrafficCalendarDlg.h | Bin 3182 -> 3278 bytes TrafficMonitor/TrafficMonitor.cpp | 7 +------ TrafficMonitor/TrafficMonitor.rc | Bin 199636 -> 199628 bytes TrafficMonitor/stdafx.h | 4 ++-- 7 files changed, 12 insertions(+), 11 deletions(-) diff --git a/TrafficMonitor/DrawCommon.cpp b/TrafficMonitor/DrawCommon.cpp index c8433b5e8..b058a021e 100644 --- a/TrafficMonitor/DrawCommon.cpp +++ b/TrafficMonitor/DrawCommon.cpp @@ -28,14 +28,20 @@ void CDrawCommon::SetDC(CDC * pDC) m_pDC = pDC; } -void CDrawCommon::DrawWindowText(CRect rect, LPCTSTR lpszString, COLORREF color, Alignment align, bool draw_back_ground) +void CDrawCommon::DrawWindowText(CRect rect, LPCTSTR lpszString, COLORREF color, Alignment align, bool draw_back_ground, bool multi_line) { m_pDC->SetTextColor(color); if(!draw_back_ground) m_pDC->SetBkMode(TRANSPARENT); m_pDC->SelectObject(m_pfont); CSize text_size = m_pDC->GetTextExtent(lpszString); - UINT format{ DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX }; //CDC::DrawText()函数的文本格式 + + UINT format; //CDC::DrawText()函数的文本格式 + if (multi_line) + format = DT_EDITCONTROL | DT_WORDBREAK | DT_NOPREFIX; + else + format = DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX; + if (text_size.cx > rect.Width()) //如果文本宽度超过了矩形区域的宽度,设置了居中时左对齐 { if (align == Alignment::RIGHT) diff --git a/TrafficMonitor/DrawCommon.h b/TrafficMonitor/DrawCommon.h index d0df7958f..bcbee346a 100644 --- a/TrafficMonitor/DrawCommon.h +++ b/TrafficMonitor/DrawCommon.h @@ -22,7 +22,7 @@ class CDrawCommon CDC* GetDC() { return m_pDC; } void SetBackColor(COLORREF back_color) { m_back_color = back_color; } - void DrawWindowText(CRect rect, LPCTSTR lpszString, COLORREF color, Alignment align = Alignment::LEFT, bool draw_back_ground = false); //在指定的矩形区域内绘制文本 + void DrawWindowText(CRect rect, LPCTSTR lpszString, COLORREF color, Alignment align = Alignment::LEFT, bool draw_back_ground = false, bool multi_line = false); //在指定的矩形区域内绘制文本 void SetDrawRect(CRect rect); //设置绘图剪辑区域 static void SetDrawRect(CDC* pDC, CRect rect); diff --git a/TrafficMonitor/HistoryTrafficCalendarDlg.cpp b/TrafficMonitor/HistoryTrafficCalendarDlg.cpp index 6c8e1449313bf2711bfd715037cbc8887848c135..32b52c47063c73a39046c6812ec1c33a964ac4a5 100644 GIT binary patch delta 543 zcmeydneo9c#tm(}!leua3^@$>42cXW3V3xEMGY+=22X4B-r!U|En;U^+C=bZ9bIGfdV}klK7t-hz=?pFw}}K}E^Q zdWuazEWi#meR98wII{wS?&OQ^!jsP_C{5m=7{_R|nP2I=6g$+)$$LGO^^1WHQe^;< z8erNA%GZI?Fuo>(5`!j#&g6$SsoX#s>S)f%fnGr4y<{d=*eVDjg%D7;HiN?CL_S$* zw9o;Wf}~q_vXl=Gqvm9LV{w={;>hNpt9J7hKvRurJ~%)(FSli7oP5JpZgPSm%j83f f5|i&a@J;?;m%?n!U^dxNMRanG{k_e04!a})j2(T> delta 164 zcmaE`i}A;1#tm(}yd?}p42cYBK$yvpJozl|Ycvr{e(lL!)i$wf*glS7f$L3AW>m&jGA~O~M diff --git a/TrafficMonitor/HistoryTrafficCalendarDlg.h b/TrafficMonitor/HistoryTrafficCalendarDlg.h index bab2e4b5ce8db304c54ab624da8615599c862cf9..bc4a1a454f49a0e10c55aa448f7a31522ffc0978 100644 GIT binary patch delta 96 zcmaDSaZYlB7pq1oLjgk$Lq0n`A%Yk7pp=ELlHwFLmCifG9)utGjIZ-J`e`S`v!5OTPJKj#md4C00mJBe*gdg diff --git a/TrafficMonitor/TrafficMonitor.cpp b/TrafficMonitor/TrafficMonitor.cpp index 6464180fa..4db6d0639 100644 --- a/TrafficMonitor/TrafficMonitor.cpp +++ b/TrafficMonitor/TrafficMonitor.cpp @@ -128,7 +128,7 @@ void CTrafficMonitorApp::LoadConfig() //其他设置 m_cfg_data.m_show_internet_ip = ini.GetBool(L"connection_details", L"show_internet_ip", false); - m_cfg_data.m_use_log_scale = ini.GetBool(_T("histroy_traffic"), _T("use_log_scale"), false); + m_cfg_data.m_use_log_scale = ini.GetBool(_T("histroy_traffic"), _T("use_log_scale"), true); m_no_multistart_warning = ini.GetBool(_T("other"), _T("no_multistart_warning"), false); m_notify_interval = ini.GetInt(_T("other"), _T("notify_interval"), 60); @@ -148,11 +148,6 @@ void CTrafficMonitorApp::SaveConfig() ini.WriteBool(L"general", L"show_all_interface", m_general_data.show_all_interface); //主窗口设置 - //保存前先获取窗口的位置 - //CRect rect; - //m_pMainWnd->GetWindowRect(rect); - //m_cfg_data.m_position_x = rect.left; - //m_cfg_data.m_position_y = rect.top; ini.WriteInt(L"config", L"transparency", m_cfg_data.m_transparency); ini.WriteBool(L"config", L"always_on_top", m_cfg_data.m_always_on_top); ini.WriteBool(L"config", L"lock_window_pos", m_cfg_data.m_lock_window_pos); diff --git a/TrafficMonitor/TrafficMonitor.rc b/TrafficMonitor/TrafficMonitor.rc index 48e06a89b78a6a12e99bbb060c37bb79e168cb21..95f68916455a8d185bd1380451d281a7de5f3d05 100644 GIT binary patch delta 707 zcmY+CT}abW6u|Gfn_4=S4zmB)$iHT2HFaCdX68~MbgY~o*#`!jAA3+!M&ty+FESw$ z&8~E4iOxXuaWLZcBoa|CMi|;t4;dChsVt%gG3;(?FfNyS?z!i{{rx!0s9Ho-@bgiy zpsSG1vVqh|FypQf?Cj35pu$A**_f2aDkKY-*_NckKsIEs1t~Xr?G&|B4#>jfCsY#( zXnkJD$8a~8AfM-T(&rFbdsGS{2mSCZq#7yTk98sM=$b-tmRQ-6{|tH`fIp-k547Uf zk5oeA2KZiHfgV|%Gvu!uZyCP!ZupsJyya;lJ&u25DAk**Zq^yAWl}=CVl|O^a!+iT zZ2FW84H{}ixg9QGaT>(qVmjC~dksllM_k1X**BtP`V81nScnDd3+W6loPbvfGZ8;E zLD@dK^#DEcz`~ODKm2~8L!1RT?SPXwKLHY37?im_3zo0PSeOF-x)*E$oeK@8=$;N8 z^NzmY>-S+h4lFEXB8Mjr!Q-;{qMnkr4`a-|EwL|a+5Gzw7J)O$}44IAxo@0O2dYPyz{7ObZ}}sQ?{C1 z^+{-0NU~AvP-<2qkt7S@Vn&Uubm}}i_5bxhCEYpcJeToefsju(CRoSOgk@0?%sAsn zM4LXBycysTWuXvfq&%#Z%%I@Cq$fuwq@h>J{TjPLp`{wgQk{tt4zSRDKPX_~#sOFW z)i-SiZP(Pt^k|EYpqOEZB6$e5RGqUbaM@F1U3O8-7mD%BokJaC;8v4oSKGlrofj-m z^}k;m(BERBCj;2Aq18pUR0yLJBUmxJ&G|jK)1dE%gZ9&5``;k6y9g3`#|=Cw3(o69 zkgnKo8m`g21V|3Je*~VxgD5;|3S5