Delphi desktop screenshot in Windows10, issue with GetDeviceCaps

后端 未结 1 1362
醉梦人生
醉梦人生 2021-01-06 03:23

How can I get the correct screen size to take a screenshot in Windows10? it seems to get incorrect values (maybe DPI issue?)

i.e

// screenshot
b := T         


        
1条回答
  •  清歌不尽
    2021-01-06 04:21

    You need to make your application fully High DPI aware in order to get proper values for taking screen snapshot.

    You can do that by adding following section into your application manifest

      
        
          true/PM
        
      
    

    Complete example of custom manifest for Windows 10

    
    
    
    
       
           
                 
                
    
                
                
    
                
                
    
                
                
    
                
                 
           
      
    
      
    
      
        
          
        
      
    
      
        
          true/PM
        
      
    
    
        
          
            
            
           
      
    
    
    

    Note: Windows 10 have introduced Per-monitor DPI awareness. Above manifest turns that awareness on with true/PM value (PM - Per Monitor).

    Since Delphi introduced support for Per-Monitor DPI in Seattle, applications compiled with older versions will not properly scale in multi-monitor setups that have different DPI settings for each monitor on Windows 10. Depending on the purpose of your application and user base you can either live with such behavior or you would have to upgrade to newest Delphi (it is also important to note that this is new feature and it does have some bugs that may or not be relevant in your case)

    0 讨论(0)
提交回复
热议问题