1

親ウィンドウと 4 つの子ウィンドウを持つ単純なアプリがあります。設定をオンWindows xpにしWindows 7125%表示するのは問題ないようです。

ただし、それ自体ではWindows 7なく125%Windows 10 125%windows 、 menu 、 text 、および message ボックスがぼやけ、子ウィンドウがオーバーフローします。

見栄えがよくなるように修正したいので、dpiに従ってサイズを更新されたサイズに置き換えようとしました:

//Get resoulation 
int resX=GetSystemMetrics(SM_CXVIRTUALSCREEN) , resY=GetSystemMetrics(SM_CYVIRTUALSCREEN);
//Get current dpi
HDC screen = GetDC(0);
int dpiX = GetDeviceCaps(screen, LOGPIXELSX);
int dpiY = GetDeviceCaps(screen, LOGPIXELSY);
//Do some calculations about the resoulation 
if( resX <= 800 ){
        winWidth=resX/1.45;
        winHeight=resY/1.3;
    }
//...

//Update width and height of the main window according to the current dpi
int updatedWinWidth=(winWidth * dpiX) / 96 , updatedWinHeight=(winHeight * dpiY) / 96 ;
//Creating parent window with updated width and height
hwnd=CreateWindowEx( WS_EX_CLIENTEDGE , myClassName , L"Compressor Reporter" ,  WS_OVERLAPPED  | WS_MINIMIZEBOX | WS_SYSMENU ,CW_USEDEFAULT, CW_USEDEFAULT,  updatedWinWidth , updatedWinHeight, NULL , NULL , hInstance , NULL );

//Updating width and height for child window, width and height variables are the dafault width and height for the child 
int updatedWidth = ( width * dpiX) / 96 , updatedHeight= (height * dpiY) / 96;
//Creating the child window
hwndList1 = CreateWindow(WC_LISTVIEW , L"" ,  WS_VISIBLE | WS_CHILD | LVS_REPORT | WS_BORDER  | WS_VSCROLL | LVS_OWNERDRAWFIXED, middle-(10+updatedWidth) , middleH-(10+updatedHeight) , updatedWidth , updatedHeight, hwnd, NULL, GetModuleHandle(NULL), 0); 



//Font settings
HDC hdc=GetDC( hHeader1);
int points=0;
switch(GetDeviceCaps( hdc , LOGPIXELSY)){
    case 96:
        points=11;
        break;
    default:
        points=10.5;
}

int fonth=-MulDiv(points, GetDeviceCaps( hdc , LOGPIXELSY) , 72 );

ReleaseDC(hHeader1 , hdc);

hF2=CreateFont(fonth, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_SWISS, L"Tahoma");

SendMessage(hHeader1,WM_SETFONT,(WPARAM)hF2,MAKELPARAM(TRUE,0));

ただし、結果は同じです。

また、次のように変更し、その中にタグCompressor Reporter.exe.embed.manifestを追加します。applicationしかし、アプリを再構築すると、追加したものが表示されなくなり、applicationタグが表示されません。

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<application xmlns="urn:schemas-microsoft-com:asm.v3">
 <windowsSettings>
        <dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
        <dpiAware>true</dpiAware>
    </windowsSettings>
</application>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  <security>
   <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
      </requestedPrivileges>
    </security>
</trustInfo>
</assembly>

私は何を間違っていますか、ぼやけたウィンドウ、テキスト、メニュー、およびメッセージボックスを修正し、子ウィンドウを正しく配置するにはどうすればよいですか?

ありがとう

4

1 に答える 1