• Register now to get access to thousands of Tutorials, Leaked content, Hot NSFW and much more. Join us as we build and grow the community.

Advertise Here

Advertise Here

Advertise Here

Zoom Application - Lock The Zoom Area (VB.NET)

daniyal007

Token Distribution Expert
D Rep
0
0
0
Rep
0
D Vouches
0
0
0
Vouches
0
Posts
67
Likes
168
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 200 XP
This tutorial is a continuation of my other tutorial entitled http://www.sourcecodester.com/tutorials/visual-basic-net/9375/creating-zoom-application-vbnet.html. But this time, I added some twist such as locking the selected zoom area after zooming it using the hovering of the mouse.

Now, let's start this tutorial!

1. Let's start with creating a Windows Form Application for this tutorial by following the following steps in Microsoft Visual Studio: Go to File, click New Project, and choose Windows Application.

2. Add a Timer on the Form named Timer1. Add also a MenuStrip to have a menu on the top.

Have this design below:

zoomlockdes.png


3. Now, we will code our program.

We will declare first the variables. This will have the Graphics library and the bitmap that we will use.

  1. Dim

    g As

    Graphics =

    Me

    .

    CreateGraphics

  2. Dim

    bmp As

    Bitmap

Then after that we will code for the Tick event of the Timer. This will totally create image out from the mouse hovering to zoom the location of the mouse cursor.

  1. Private

    Sub

    Timer1_Tick(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    Timer1.

    Tick
  2. bmp =

    New

    Bitmap(

    250

    , 200

    )
  3. g =

    Graphics.

    FromImage

    (

    bmp)
  4. g.

    CopyFromScreen

    (

    MousePosition.

    X

    -

    100

    , MousePosition.

    Y

    -

    10

    , 0

    , 0

    , New

    Size(

    300

    , 300

    )

    )
  5. PictureBox1.

    Image

    =

    bmp
  6. End

    Sub

Start the Timer from your Form_Load.

  1. Private

    Sub

    Form1_Load(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    MyBase

    .

    Load
  2. Timer1.

    Start

    (

    )
  3. End

    Sub

4. Lastly, for locking the zoom area, we will just disable the time, and then select the lock area.

  1. Private

    Sub

    LockZoomAreaToolStripMenuItem_Click(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    LockZoomAreaToolStripMenuItem.

    Click
  2. If

    LockZoomAreaToolStripMenuItem.

    Checked

    =

    True

    Then
  3. Timer1.

    Enabled

    =

    False
  4. SelectZoomAreaToolStripMenuItem.

    Enabled

    =

    True

  5. Else
  6. Timer1.

    Enabled

    =

    True
  7. SelectZoomAreaToolStripMenuItem.

    Enabled

    =

    False

  8. End

    If
  9. End

    Sub

Output:

zoomlock.png


For more inquiries and need programmer for your thesis systems in any kind of programming languages, just contact my number below.

Best Regards,

Engr. Lyndon Bermoy
IT Instructor/System Developer/Android Developer/Freelance Programmer
Mobile: 09488225971
Landline: 826-9296
E-mail:[email protected]

Add and Follow me on Facebook: https://www.facebook.com/donzzsky

Visit and like my page on Facebook at: https://www.facebook.com/BermzISware

 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.

452,501

352,162

352,176

Top