25 Mart 2013 Pazartesi
FORM İÇİNDE KONTROL SÜRÜKLEME
Proje Kodlarını indirmek için..
...........................................
TIKLA
Public Class Form1 #Region " SÜRÜKLEME İŞİNİ YAPAN CLASS..." Public Class DragInfo Public Property Farenin_ilk_Konumu As Point Public Property Baslama_Yeri As Point Public Sub New(ByVal MouseCoords As Point, ByVal Location As Point) Farenin_ilk_Konumu = MouseCoords Baslama_Yeri = Location End Sub Public Function NewLocation(ByVal MouseCoords As Point) As Point Dim yer As New Point(Baslama_Yeri.X + (MouseCoords.X - Farenin_ilk_Konumu.X), Baslama_Yeri.Y + (MouseCoords.Y - Farenin_ilk_Konumu.Y)) Return yer End Function End Class #End Region #Region " FORM OLAYLARI" Private Sub Form1_FormClosing(sender As System.Object, e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing My.Settings.sol = Me.Left My.Settings.üst = Me.Top End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load My.Settings.Reload() Me.Top = My.Settings.üst Me.Left = My.Settings.sol ComboBox1.Items.Add("ERDOĞAN ASLAN") ComboBox1.Items.Add("EGE ERDEM") ComboBox1.Items.Add("MAHMUT TÜMER") ComboBox1.Items.Add("KADİR FIRAT") ComboBox1.SelectedIndex = 0 LinkLabel1.Text = "Bilgisayar Dünyası" LinkLabel1.Links.Add(0, LinkLabel1.Text.Length, "http://eraslancemil.blogspot.com/") SürüklenebilirYap(Button1) SürüklenebilirYap(TextBox1) SürüklenebilirYap(PictureBox1) SürüklenebilirYap(LinkLabel1) SürüklenebilirYap(ListBox1) SürüklenebilirYap(ComboBox1) SürüklenebilirYap(CheckBox2) End Sub Private Sub SürüklenebilirYap(ByVal Control As Control) AddHandler Control.MouseDown, Sub(sender As Object, e As MouseEventArgs) StartDrag(Control) AddHandler Control.MouseMove, Sub(sender As Object, e As MouseEventArgs) Drag(Control) AddHandler Control.MouseUp, Sub(sender As Object, e As MouseEventArgs) StopDrag(Control) End Sub Private Sub StartDrag(ByVal Control As Control) If CheckBox1.Checked = True Then Control.Tag = New DragInfo(Form.MousePosition, Control.Location) End Sub Private Sub Drag(ByVal Control As Control) If Control.Tag IsNot Nothing AndAlso TypeOf Control.Tag Is DragInfo Then Dim Bilgi As DragInfo = CType(Control.Tag, DragInfo) Dim Yeni_Yer As Point = Bilgi.NewLocation(Form.MousePosition) If Me.ClientRectangle.Contains(New Rectangle(Yeni_Yer, Control.Size)) Then Control.Location = Yeni_Yer End If End Sub Private Sub StopDrag(ByVal Control As Control) Control.Tag = Nothing End Sub Public Sub ReLoadFrm() 'Load (RELOAD) olayı çağrılıp form güncelleniyor Dim frm As New Form1 frm.Show() Me.Close() End Sub Private Sub Form1_MouseMove(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove Label1.Visible = False Label1.Text = "" End Sub Private Sub TextBox1_MouseMove(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseMove, PictureBox1.MouseMove, ListBox1.MouseMove, Label1.MouseMove, ComboBox1.MouseMove, CheckBox2.MouseMove, Button1.MouseMove If CheckBox1.Checked = False Then Label1.Visible = True Label1.Text = "Sürükleme izini için Chekbox'u işaretle.." End If End Sub #End Region #Region " SÜRÜKLENMEYEN Pic2 FORMLA İLGİLİ OLAYLAR..." Private Sub pic2_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles pic2.MouseDown If e.Button = Windows.Forms.MouseButtons.Right Then If CheckBox1.Checked = True Then Call Büyüt() End If End If End Sub Private Sub CheckBox1_CheckedChanged(sender As System.Object, e As System.EventArgs) Handles CheckBox1.CheckedChanged If CheckBox1.Checked = False Then Call ReLoadFrm() End If End Sub Private Sub pic2_DoubleClick(sender As System.Object, e As System.EventArgs) Handles pic2.DoubleClick Me.pic2.Dock = DockStyle.None Call ReLoadFrm() End Sub Private Sub pic2_MouseLeave(sender As System.Object, e As System.EventArgs) Handles pic2.MouseLeave Dim tooltip As New ToolTip() tooltip.SetToolTip(pic2, "BU KONTROL SÜRÜKLENEMEZ.." & vbCrLf & "Büyütmek içn Sağ fare tuşuna" & vbCrLf & "Çıkmak için ise Çift Tıkla") End Sub Public Sub Büyüt() Me.pic2.Dock = DockStyle.Fill Me.pic2.SizeMode = PictureBoxSizeMode.StretchImage Dim en, boy As Integer en = Kontrol_Taşıma.My.Resources.Resources.hatn.Size.Width boy = Kontrol_Taşıma.My.Resources.Resources.hatn.Size.Height Me.Width = en Me.Height = boy End Sub #End Region #Region " LİNKLABEL İLE WEB SAYFASINA ULAŞMA..." 'labelin ilk bölümü load içinde belirleniyor '__________________________________________________ 'LinkLabel1.Text = "Bilgisayar Dünyası" ' LinkLabel1.Links.Add(0, LinkLabel1.Text.Length, "http://eraslancemil.blogspot.com/") '___________________________________________________ Private Sub LinkLabel1_LinkClicked(sender As System.Object, e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked If My.Computer.Network.IsAvailable = False Then MsgBox("Bilgisayarınız İnternete Bağlı Değil.") Exit Sub End If System.Diagnostics.Process.Start(e.Link.LinkData) End Sub #End Region End Class
Sonraki Kayıt
Önceki Kayıt
Ana Sayfa