02-11-22, 11:16 PM
(25-10-22, 07:21 PM)asmarsou كتب :هذه طريقة اخرى عن طريق قائمة لاداة النص(25-10-22, 07:03 PM)Taha Okla كتب :بارك الله فيك(25-10-22, 06:40 PM)asmarsou كتب : بارك الله فيك اخي الكريم و جزاك كل خير
كنت بصدد العمل على نفس الفكرة و لكن بشكل مختلف فهل ممكن اللون الاخضر ينتقل تباعا في كل مرة اي ليبل واحد اخضر
في كل مرة لعدد غير محدد لليبل اكون شاكر ... وبارك الله فيك مرة اخرى
نفس الكود لكن بعد إعادة الترتيب :
كود :
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
tes = tes + 1
If tes = 10 Then
Me.Label1.ForeColor = System.Drawing.Color.Green
Me.Label2.ForeColor = System.Drawing.Color.Yellow
Me.Label3.ForeColor = System.Drawing.Color.Yellow
ElseIf tes = 20 Then
Me.Label2.ForeColor = System.Drawing.Color.Green
Me.Label1.ForeColor = System.Drawing.Color.Yellow
Me.Label3.ForeColor = System.Drawing.Color.Yellow
ElseIf tes = 30 Then
Me.Label3.ForeColor = System.Drawing.Color.Green
Me.Label1.ForeColor = System.Drawing.Color.Yellow
Me.Label2.ForeColor = System.Drawing.Color.Yellow
tes = 0
End If
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Timer1.Start()
Me.Label1.ForeColor = System.Drawing.Color.Yellow
Me.Label2.ForeColor = System.Drawing.Color.Yellow
Me.Label3.ForeColor = System.Drawing.Color.Yellow
End Sub
PHP كود :
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Timer1.Start()
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Dim lbls As Label() = New Label() {Label1, Label2, Label3, Label4, Label5, Label6, Label7, Label8, Label9, Label10, Label11, Label12}
Static idx As Integer = 0 'لاخذ رقم او اندكس النص من القائمة
If idx < lbls.Count Then
'تمرير اللون بالتتابع
idx += 1
For Each lbl As Label In lbls
lbl.ForeColor = Color.Yellow 'لتضمين اللون الاصفر للنص لو لم يكن النص الحالي
Dim currentLbl = lbl ' تعريف النص الحالي
If currentLbl.Name = "Label" & idx Then
currentLbl.ForeColor = Color.Lime
End If
Next
Else
' Timer1.Stop() 'لايقاف العملية فور الانتهاءاي عند آخر نص
idx = 0 'للبدء من جديد
End If
End Sub
End Class

