17 Mayıs 2013 Cuma
FormBorder=None olan Forma Kenar Çizgisi Eklemek,Sürüklemek, Skin kullanmak
Public Class Form1 #Region " FORM TAŞIMAK..." Const i As Integer = &HA1 Const j As Integer = 2 Private Sub Form1_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles SuruklePic.MouseDown, MyBase.MouseDown If e.Button = Windows.Forms.MouseButtons.Left Then Me.Capture = False 'Panelden,pictureden,textten,vb sürüklemek için o nesne adınıncapture özelliğini False yapınız örnek:Picture1.capture=false, panel1.capture=false gibi.. Dim msg As Message = Message.Create(Me.Handle, i, New IntPtr(j), IntPtr.Zero) Me.DefWndProc(msg) End If End Sub #End Region #Region " KENARSIZ FORMU BÜYÜTÜP KÜÇÜLTMEK.." #Region " Boyutlandırma değişkenleri" Dim GripDrag As Boolean Dim InitialSizeX As Integer Dim InitialSizeY As Integer #End Region Private Sub SuruklePic_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles SuruklePic.MouseDown If e.Button = Windows.Forms.MouseButtons.Left Then GripDrag = True InitialSizeX = Me.Width InitialSizeY = Me.Height End If End Sub Private Sub SuruklePic_MouseMove(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles SuruklePic.MouseMove If GripDrag = True Then Me.Width = InitialSizeX + (Windows.Forms.Cursor.Position.X - (Me.Width + Me.Location.X)) Me.Height = InitialSizeY + (Windows.Forms.Cursor.Position.Y - (Me.Height + Me.Location.Y)) InitialSizeX = Me.Width InitialSizeY = Me.Height Me.Refresh() End If End Sub Private Sub SuruklePic_MouseUp(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles SuruklePic.MouseUp GripDrag = False End Sub #End Region Private Sub PictureBox1_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox1.Click Me.Close() End Sub Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click Form2.Show() End Sub End Class
Public Class Form2 #Region " FORM TAŞIMAK..." Const i As Integer = &HA1 Const j As Integer = 2 Private Sub Form2_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles SuruklePic.MouseDown, MyBase.MouseDown If e.Button = Windows.Forms.MouseButtons.Left Then Me.Capture = False 'Panelden,pictureden,textten,vb tut sürükle Dim msg As Message = Message.Create(Me.Handle, i, New IntPtr(j), IntPtr.Zero) Me.DefWndProc(msg) End If End Sub #End Region #Region " FORM KENAR ÇİZGİSİ EKLEMEK..." Private Sub Form2_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint Dim g As Graphics = Me.CreateGraphics Dim cizgi As New Pen(Color.Gray, 5) 'Color.Black,Color.Blue, 'Color.red Dim dikdortgen As Rectangle = Me.ClientRectangle dikdortgen.Inflate(-1, -1) g.DrawRectangle(cizgi, dikdortgen) g.Dispose() End Sub #End Region #Region " KENARSIZ FORMU BÜYÜTÜP KÜÇÜLTMEK.." #Region " Boyutlandırma değişkenleri" Dim GripDrag As Boolean Dim InitialSizeX As Integer Dim InitialSizeY As Integer #End Region Private Sub SuruklePic_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles SuruklePic.MouseDown If e.Button = Windows.Forms.MouseButtons.Left Then GripDrag = True InitialSizeX = Me.Width InitialSizeY = Me.Height End If End Sub Private Sub SuruklePic_MouseMove(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles SuruklePic.MouseMove If GripDrag = True Then Me.Width = InitialSizeX + (Windows.Forms.Cursor.Position.X - (Me.Width + Me.Location.X)) Me.Height = InitialSizeY + (Windows.Forms.Cursor.Position.Y - (Me.Height + Me.Location.Y)) InitialSizeX = Me.Width InitialSizeY = Me.Height Me.Refresh() End If End Sub Private Sub SuruklePic_MouseUp(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles SuruklePic.MouseUp GripDrag = False End Sub #End Region Private Sub PictureBox1_Click(sender As System.Object, e As System.EventArgs) Handles PictureBox1.Click Me.Close() End Sub End Class
Sonraki Kayıt
Önceki Kayıt
Ana Sayfa