İçeriğe geç
ShiftDelete.Net
Haber ara/ SDN'ye SorGiriş
Haber Akışı SDNTV İnceleme Forum Yapay Zeka Akıllı Telefon Elektrikli Otomobil Oyun ShiftDelete.Net Global Teknoloji Haberleri Mobil Otomobil Donanım Savunma Bilim Sosyal Medya İnternet Giyilebilir Teknoloji Rehber Ürünler Son dakika Yazarlar
  1. Ana sayfa
  2. Topluluk
  3. Programlama
  4. Programlama Dilleri
Programlama Dilleri

Visual Basic formborderstyle none iken formu hareket ettirme.

spyscorpio30.08.20114 cevap7.275 görüntüleme
2011'den beri104 mesaj
#1
Normalde formborderstyle none iken hiçbişi olmaz ama bu kodu Form1 in altına yapıştırırsanız hareket ettirebilirsiniz. Dikkat edin Form1_Load değil Form1 in altına!
Dim IsDraggingForm As Boolean = False
    Private MousePos As New System.Drawing.Point(0, 0)

    Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseDown
        If e.Button = MouseButtons.Left Then
            IsDraggingForm = True
            MousePos = e.Location
        End If
    End Sub

    Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseUp
        If e.Button = MouseButtons.Left Then IsDraggingForm = False
     End Sub

    Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseMove
        If IsDraggingForm Then
            Dim temp As Point = New Point(Me.Location + (e.Location - MousePos))
            Me.Location = temp
            temp = Nothing
        End If
    End Sub

Eğer arka plan olarak picturebox kullancaksanız picturebox'un enabled özelliğini false yapın.
Cevaplar
Misafir
#2
abi allah ne muraidn verse versin,. kac gundur ariyorum sonunda buldum coook coook tesekkur ederim supersin!!!!!
Misafir
#3
çalışmıyor yada ben beceremedim if { paramları olmadan c# nasıl çalıştırıcak bu kodu ?
Misafir
#4
Normalde formborderstyle none iken hiçbişi olmaz ama bu kodu Form1 in altına yapıştırırsanız hareket ettirebilirsiniz. Dikkat edin Form1_Load değil Form1 in altına!
Dim IsDraggingForm As Boolean = False
    Private MousePos As New System.Drawing.Point(0, 0)

    Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseDown
        If e.Button = MouseButtons.Left Then
            IsDraggingForm = True
            MousePos = e.Location
        End If
    End Sub

    Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseUp
        If e.Button = MouseButtons.Left Then IsDraggingForm = False
     End Sub

    Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles MyBase.MouseMove
        If IsDraggingForm Then
            Dim temp As Point = New Point(Me.Location + (e.Location - MousePos))
            Me.Location = temp
            temp = Nothing
        End If
    End Sub

Eğer arka plan olarak picturebox kullancaksanız picturebox'un enabled özelliğini false yapın.
Misafir
#5
üsteki yorum yanlış ADAMSIN DİCEKTİM :)

Cevabını yaz

Cevap yazmak için giriş yap ya da üye ol. Eski forum kullanıcı adın ve parolanla girebilirsin.