• We just launched and are currently in beta. Join us as we build and grow the community.

Magnifying Form Window In VB.NET

steveb0ne

Application Logic Tester
S Rep
0
0
0
Rep
0
S Vouches
0
0
0
Vouches
0
Posts
133
Likes
49
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 200 XP
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.
break
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'.
break

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

break
But that's not the end of the code, in the timer we would have to declare a drawing.bitmap.
break

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

break
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.
break

Timer1.Interval = 10
Timer1.Start()
Me.Hide()

break
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.


Download
You must upgrade your account or reply in the thread to view hidden text.
 

452,292

323,526

323,535

Top