[Ttssh2-commit] [7722] ツールチップの高DPI対応

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 6月 1日 (土) 01:13:00 JST


Revision: 7722
          https://osdn.net/projects/ttssh2/scm/svn/commits/7722
Author:   zmatsuo
Date:     2019-06-01 01:13:00 +0900 (Sat, 01 Jun 2019)
Log Message:
-----------
ツールチップの高DPI対応

- TipWinCreate()#teraterm/common/tipwin.cpp のフォント生成時
  DPIに合わせて拡大するようにした
- #include でファイル名の大文字小文字をファイルに合わせた

Modified Paths:
--------------
    trunk/teraterm/common/tipwin.cpp

-------------- next part --------------
Modified: trunk/teraterm/common/tipwin.cpp
===================================================================
--- trunk/teraterm/common/tipwin.cpp	2019-05-31 13:09:31 UTC (rev 7721)
+++ trunk/teraterm/common/tipwin.cpp	2019-05-31 16:13:00 UTC (rev 7722)
@@ -62,7 +62,7 @@
 
 #include "ttlib.h"		// for GetMessageboxFont()
 
-#include "TipWin.h"
+#include "tipwin.h"
 
 #define	FRAME_WIDTH	6
 
@@ -230,8 +230,9 @@
 TipWin *TipWinCreate(HWND src, int cx, int cy, const TCHAR *str)
 {
 	TipWin *pTipWin;
-	HINSTANCE hInst = (HINSTANCE)GetWindowLongPtr(src, GWLP_HINSTANCE);
-	LOGFONT logfont;
+	const HINSTANCE hInst = (HINSTANCE)GetWindowLongPtr(src, GWLP_HINSTANCE);
+	LOGFONTA logfont;
+	const UINT uDpi = GetMonitorDpiFromWindow(src);
 
 	register_class(hInst);
 	pTipWin = (TipWin *)malloc(sizeof(TipWin));
@@ -243,6 +244,8 @@
 	pTipWin->tip_bg = GetSysColor(COLOR_INFOBK);
 	pTipWin->tip_text = GetSysColor(COLOR_INFOTEXT);
 	GetMessageboxFont(&logfont);
+	logfont.lfWidth = MulDiv(logfont.lfWidth, uDpi, 96);
+	logfont.lfHeight = MulDiv(logfont.lfHeight, uDpi, 96);
 	pTipWin->tip_font = CreateFontIndirect(&logfont);
 	CalcStrRect(pTipWin);
 	pTipWin->hParentWnd = src;


Ttssh2-commit メーリングリストの案内
Back to archive index