Advertisement
NiCz

How To Make A Magnifier In Microsoft Visual Basic

Aug 31st, 2012
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.88 KB | None | 0 0
  1. How To Make A Magnifier In Microsoft Visual Basic
  2. ~
  3. Requirements:
  4. - Timer1 (Enabled: True) (Interval: 1)
  5. - PictureBox (SizeMode: StretchImage) (DockL FiLL)
  6.  
  7. Right mouse-click the form and choose "View Code"
  8. Paste the code below to the code section.
  9. ~
  10.  Public Function capturescreen(ByVal links As Integer, ByVal rechts As Integer) As Bitmap
  11.         Dim b As New Bitmap(CInt(PictureBox1.Width / 2), CInt(PictureBox1.Height / 2))
  12.         Dim g As Graphics = Graphics.FromImage(b)
  13.         g.CopyFromScreen(links - (PictureBox1.Width / 4), rechts - (PictureBox1.Height / 4), 0, 0, b.Size)
  14.         g.Dispose()
  15.         Return b
  16.     End Function
  17.  
  18.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  19.         PictureBox1.Image = capturescreen(MousePosition.X, MousePosition.Y)
  20.     End Sub
  21.  
  22. -- DEBUG! --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement