منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب
تحريك ال Panel على الفورم وقت التشغيل - نسخة قابلة للطباعة

+- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb)
+-- قسم : الأقسام التعليمية - المنتدى القديم (http://vb4arb.com/vb/forumdisplay.php?fid=90)
+--- قسم : مكتبة أكواد المنتدى (http://vb4arb.com/vb/forumdisplay.php?fid=111)
+---- قسم : مكتبة أكواد .net (http://vb4arb.com/vb/forumdisplay.php?fid=117)
+---- الموضوع : تحريك ال Panel على الفورم وقت التشغيل (/showthread.php?tid=6229)



تحريك ال Panel على الفورم وقت التشغيل - RaggiTech - 17-10-12

كاتب الموضوع : Boutemine Oualid

السلام عليكم و رحمة الله وبركاته
C#

كود :
Point start = new Point();
private void panel_MouseMove( object sender, MouseEventArgs e )
{
Panel p = sender as Panel;
if ( e.Button == MouseButtons.Left )
{
Point mousePos = this.PointToClient( Control.MousePosition );
if ( start.IsEmpty )
start = new Point( mousePos.X - p.Left, mousePos.Y - p.Top );
p.Location = new Point( mousePos.X - start.X, mousePos.Y - start.Y );
}
else if ( !start.IsEmpty )
start = new Point();
}
VB.NET

كود :
Private start As New Point()
Private Sub panel_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles Me.panel.MouseMove
Dim p As Panel = sender
If e.Button = MouseButtons.Left Then
Dim mousePos As Point = Me.PointToClient(Control.MousePosition)
If start.IsEmpty Then start = New Point(mousePos.X - p.Left, mousePos.Y - p.Top) p.Location =
New Point(mousePos.X - start.X, mousePos.Y - start.Y)
ElseIf Not start.IsEmpty Then
start = New Point()
End If
End Sub