Snap to Control : Frame Form « GUI « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » GUI » Frame FormScreenshots 
Snap to Control
  

Imports System.Windows.Forms
Imports System.Drawing
Public Class Form1
    Inherits System.Windows.Forms.Form

    Public Sub New()
        MyBase.New()
        InitializeComponent()
    End Sub
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel
    <System.Diagnostics.DebuggerStepThrough()Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
        Me.Button1 = New System.Windows.Forms.Button()
        Me.LinkLabel1 = New System.Windows.Forms.LinkLabel()
        Me.SuspendLayout()
        '
        Me.Button1.Image = CType(resources.GetObject("Button1.Image"), System.Drawing.Bitmap)
        Me.Button1.Location = New System.Drawing.Point(19248)
        Me.Button1.Size = New System.Drawing.Size(16864)
        '
        Me.LinkLabel1.Location = New System.Drawing.Point(2416)
        Me.LinkLabel1.Text = "Click here to snap!"
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(513)
        Me.ClientSize = New System.Drawing.Size(544182)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.LinkLabel1, Me.Button1})
        Me.Text = "Snapping to a Control"
        Me.ResumeLayout(False)

    End Sub
    Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgsHandles LinkLabel1.LinkClicked
        SnapToControl(Button1)
    End Sub

    Public Sub SnapToControl(ByVal Control As Control)
        Dim objPoint As Point = Control.PointToScreen(New Point(00))
        Cursor.Position = objPoint
    End Sub
End Class

   
    
  
Related examples in the same category
1.Simple window frameSimple window frame
2.Form Opacity in VBForm Opacity in VB
3.Non rectangle window in VBNon rectangle window in VB
4.Get Frame Client Rectangle SizeGet Frame Client Rectangle Size
5.Resetting a Form
ww___w.__ja_v___a__2__s_.__c__o__m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.