عليك أن تضيف تايمر الي SplashScreen ثم اكتب الكود بالشكل التالي
انا اعتقد انه من الافضل لك ان يكون وقت التايمر اقل من وقت عرض Splash Screen علي الشاشة
ويمكن تحديد وقت عرض Splash Screen علي الشاشة عن طريقة تغيير قيمة MinimumSplashScreenDisplayTime Property و هذا يتم من ApplicationEvent و يمكنك الوصول له من Properties الخاصة بالمشروع حيث ستجد باتون بجوار المكان الذي تحدد منه SplashScreen الخاصة بالمشروع
و شكل الكود الذ سيقوم بتغيير وقت عرض Splash Screen علي الشاشة سيكون كالأتي:
كود :
Namespace My
' The following events are available for MyApplication:
'
' Startup: Raised when the application starts, before the startup form is created.
' Shutdown: Raised after all application forms are closed. This event is not raised if the application terminates abnormally.
' UnhandledException: Raised if the application encounters an unhandled exception.
' StartupNextInstance: Raised when launching a single-instance application and the application is already active.
' NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
Partial Friend Class MyApplication
Protected Overrides Function OnInitialize(commandLineArgs As ObjectModel.ReadOnlyCollection(Of String)) As Boolean
' Set the display time to 5000 milliseconds (5 seconds).
Me.MinimumSplashScreenDisplayTime = 10000
Return MyBase.OnInitialize(commandLineArgs)
End Function
End Class
End Namespace
و الكود التالي يوضح كيفية تحريك شكل هندسي عبارة عن كرة علي سطح Splash Screen Form
كود :
Imports System.Drawing.Drawing2D
Public NotInheritable Class SplashScreen1
Private dia As Integer = 50
Private angle As Integer = 0
Private x As Integer
Private y As Integer
Private Sub SplashScreen1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Timer1.Interval = 1000
Timer1.Start()
End Sub
Protected Overrides Sub OnPaint(e As PaintEventArgs)
MyBase.OnPaint(e)
e.Graphics.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
Dim origin As New Point(ClientRectangle.Width / 2, ClientRectangle.Height / 2)
Dim raduis As Integer = 120
x = Math.Cos(angle) * raduis
y = Math.Sin(angle) * raduis
Dim ballPoint As Point = New Point(origin.X + x, origin.Y + y)
Dim rect As Rectangle = New Rectangle(ballPoint.X - dia / 2, ballPoint.Y - dia / 2, dia, dia)
Using lgb As New Drawing2D.LinearGradientBrush(rect, Color.Orange, Color.Black, 90)
e.Graphics.FillEllipse(lgb, rect)
End Using
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
For increment = 0 To 360
angle += increment
Next
Invalidate()
End Sub
End Class
في المرفقات ستجد نسخة كاملة من الكود ...الملف مكتوب ببرنامج الفيجوال استوديو 2012