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.Development
8.Event
9.File Directory
10.Generics
11.GUI
12.Language Basics
13.LINQ
14.Network Remote
15.Security
16.Thread
17.Windows Presentation Foundation
18.Windows System
19.XML
20.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
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.