24-08-15, 04:51 PM
السلام عليكم احبيتي ...
اما بعد ...
احببت ان اشاركم كود كتبته بيدي وهو كود بسيط لكيفية عمل Notification Form تظهر بجانب الساعه وتختفي بعد 5 ثواني
1- افتح مشروع جديد ..
2- ادرج اداتا Timer اثنتان وسمي الاولى Timer والثانية Timer1
وادرج الاكواد التاليه في الفورم :
كود :
Public Class Notfrm
Dim screenWidth As Integer = Screen.PrimaryScreen.Bounds.Width
Dim screenHeight As Integer = Screen.PrimaryScreen.Bounds.Height
Private Sub Notfrm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Location = New Point(screenWidth - Me.Size.Width, screenHeight)
End Sub
Private Sub Timer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer.Tick
Application.DoEvents()
If Me.Location = New Point(Me.Location.X, screenHeight - Me.Size.Height) Then
Timer.Enabled = False
Threading.Thread.Sleep(5000)
Timer1.Enabled = True
Else
Me.Location = New Point(Me.Location.X, Me.Location.Y - 1)
End If
End Sub
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Main.Show()
Main.Focus()
Me.Close()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If Me.Location = New Point(Me.Location.X, screenHeight + Me.Size.Height) Then
Me.Close()
Else
Me.Location = New Point(Me.Location.X, Me.Location.Y + 1)
End If
End Sub
End Class
افتح البرنامج ...
ستجد ان الفورم تتحرك بجانب الساعة الى الاعلى وبعدها تقف لمدة 5 ثواني ومن ثم تنزل وتختفي
اتمنى انه قد اعجبكم الكود
اخوكم في الله يزن العتوم
السلام عليكم