![]() |
|
[VB.NET] تحريك الفورمات بطريقة جميلة - نسخة قابلة للطباعة +- منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب (http://vb4arb.com/vb) +-- قسم : الأقسام التعليمية - المنتدى القديم (http://vb4arb.com/vb/forumdisplay.php?fid=90) +--- قسم : مكتبة أمثلة ومشاريع أعضاء المنتدى (http://vb4arb.com/vb/forumdisplay.php?fid=114) +---- قسم : مكتبة مشاريع VB.net (http://vb4arb.com/vb/forumdisplay.php?fid=141) +---- الموضوع : [VB.NET] تحريك الفورمات بطريقة جميلة (/showthread.php?tid=15430) |
تحريك الفورمات بطريقة جميلة - ghaner joseph - 10-04-16 لجعل برنامجك يبدو جميلا بزخرفة التحريك فورمات إليك طريقة الأتية: في الفورم الاول ضع 3زر وكتب: Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Left = (Screen.PrimaryScreen.WorkingArea.Width - Me.Width) / 5 End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click frmSlide = New Form2 frmSlide.Show() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click frmSplash = New Form3 frmSplash.Show() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click frmResize = New Form4 frmResize.Show() End Sub End Class سوف تعرف كيف تتحرك الفورمات
وفي الفورم 2 أكتب هدا الكود
Public Class Form2Public Enum AnimateWindowFlags AW_HOR_POSITIVE = &H5 AW_HOR_NEGATIVE = &H1 AW_VER_POSITIVE = &H4 AW_VER_NEGATIVE = &H8 AW_CENTER = &H10 AW_HIDE = &H10000 AW_ACTIVATE = &H20000 AW_SLIDE = &H40000 AW_BLEND = &H80000 End Enum Public Declare Auto Function AnimateWindow Lib "user32" (ByVal hwnd As IntPtr, ByVal time As Integer, ByVal flags As AnimateWindowFlags) As Boolean Sub animateWin(ByVal frmToAnimate As Form, ByVal showForm As Boolean) If showForm Then AnimateWindow(frmToAnimate.Handle, 1000, AnimateWindowFlags.AW_BLEND Or AnimateWindowFlags.AW_SLIDE) Else AnimateWindow(frmToAnimate.Handle, 1000, AnimateWindowFlags.AW_VER_POSITIVE Or AnimateWindowFlags.AW_HIDE) End If End Sub Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load animateWin(Me, True) End Sub Private Sub Form2_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed animateWin(Me, False) End Sub End Class وفي الفورم 3 أكتب هدا الكود
Public Class Form3Dim op As Single Private Sub Form3_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed For op = Me.Opacity To 0 Step -0.0005 Me.Opacity = op Next End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If Timer1.Enabled = True Then op += 0.01 Me.Opacity = op If op > 100 Then Me.Opacity = 1.0 Timer1.Enabled = False op = Nothing End If End If End Sub End Class والحمد لله الدي كرمنا بهدا العلم
|