Magnifying Form Window In VB.NET
Submitted by Stevenp12 on Friday, March 6, 2020 - 08:38.
      
  Language
              
          This program will allow you to magnify whatever the computer mouse is hovering on. You are able to resize the form too. To activate the magnifying window, you have to click on the form once.
All we need is a 'pictureBox' and a 'Timer'. The timer will do most of the job with 18 lines of code. First we have to code the mouse positions and the syncing of the magnifying form. We set our resolution in 'MousePosition.Y' and 'MousePosition.X'. 
      
            
       If MousePosition.X = 0 Then
            Me.Hide()
        Else : Me.Show()
        End If
        If MousePosition.Y > 1300 Then '780
            Me.Close()
        End If
        If MousePosition.Y  1000 Then '500
            Me.Location = (New Drawing.Point(MousePosition.X, MousePosition.Y + 75))
        Else
            Me.Location = (New Drawing.Point(MousePosition.X, MousePosition.Y - 220))
        End If        
But that's not the end of the code, in the timer we would have to declare a drawing.bitmap.
Dim picontrol As New Drawing.Bitmap(300, 300)
        Dim gx As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(picontrol)
        gx.CopyFromScreen(New Drawing.Point(MousePosition.X - (10), MousePosition.Y - (20)), New Drawing.Point(0, 0), picontrol.Size)
        Me.PictureBox1.Size = New Size(picontrol.Size.Width * 5, picontrol.Size.Height * 5)
        Me.PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage
        Me.PictureBox1.Image = picontrol
All that's rest, is the mouse click code. Go to the Form properties and set a Form1_MouseClick event. We will set our timer interval and make it start.
        Timer1.Interval = 10
        Timer1.Start()
        Me.Hide()
Hope you learn something from this! This program was made in VB.NET version 3.5 framework, in Visual Studio 2017.Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
 
              