dcsimg
Results 1 to 1 of 1

Thread: Problems screenshot at screen scale of 125%

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2018
    Posts
    1

    Problems screenshot at screen scale of 125%

    Hi, i am quite new at VB and i have a Problem.

    I have a Little test with a program that saves a screenshot. the saved Picture was Always cutted at the Bottom and on the Right side. i figuered out that the Windows scale of 125% on my machine causes that effect. if i turn to 100% everything is great. if i scale the Bounds to 1.25 also everything is fine:

    Code:
    Public Class frmHaupt
    
        Dim screenshot As System.Drawing.Bitmap
        Dim graph As Graphics
        Dim screen1 As Screen
        Dim bounds As Rectangle
    
        Dim ResolutionScale As VariantType
    
        Private Sub cmdDuplicate_Click(sender As Object, e As EventArgs) Handles cmdDuplicate.Click
            screen1 = Screen.AllScreens(0)
            bounds = screen1.Bounds
            bounds.Width = screen1.Bounds.Width * 1.25
            bounds.Height = screen1.Bounds.Height * 1.25
            screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, Imaging.PixelFormat.Format32bppArgb)
            graph = Graphics.FromImage(screenshot)
            graph.CopyFromScreen(0, 0, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
            screenshot.Save("C:\Users\Testkuebel\Desktop\test.jpg", Imaging.ImageFormat.Bmp)
        End Sub
    End Class
    I am looking for a dynamic solution. So the program should detect the scale factor and i can scale the bounds in order to the detected scale factor of windows. i do not know how to get this scale factor. dpiY and dpiX alwas Returns 96 - so i cannot use this.

    I know there are some strange Things in my Code, this is because i experimented a lot :-D
    Last edited by eyeofthetiger; Dec 13th, 2018 at 03:54 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width