تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[VB.NET] تحول الليبل للون الاخضر
#1
اخواني الكرام عندي 3/ ليبل لونهم اصفر كيف بقدر احول الليبل الاول للون الاخضر وبعد ثانية واحدة الليبل الثاني والاول ايضا يتحول للاخضر وبعد ثانية الليبل الاول والثاني والثالث ثم بعد ثانيه يعودوا للون الاصفر ويبدؤوا من جديد بشكل دائم
الرد }}}
تم الشكر بواسطة:
#2
(25-10-22, 12:11 AM)عماد سلمان منذر كتب : اخواني الكرام عندي 3/ ليبل لونهم اصفر كيف بقدر احول الليبل الاول للون الاخضر وبعد ثانية واحدة الليبل الثاني والاول ايضا يتحول للاخضر وبعد ثانية الليبل الاول والثاني والثالث ثم بعد ثانيه يعودوا للون الاصفر ويبدؤوا من جديد بشكل دائم

كود :
Public Class Form1
   Dim tes As IntPtr
   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
       ElseIf tes = 20
           Me.Label2.ForeColor = System.Drawing.Color.Green

       ElseIf tes = 30
           Me.Label3.ForeColor = System.Drawing.Color.Green
       ElseIf tes = 40
           Me.Label1.ForeColor = System.Drawing.Color.Yellow
           Me.Label2.ForeColor = System.Drawing.Color.Yellow
           Me.Label3.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()
   End Sub
End Class


الملفات المرفقة
.rar   WindowsApplication9.rar (الحجم : 60.87 ك ب / التحميلات : 19)
الرد }}}
#3
(25-10-22, 01:39 AM)bidaya كتب :
(25-10-22, 12:11 AM)عماد سلمان منذر كتب : اخواني الكرام عندي 3/ ليبل لونهم اصفر كيف بقدر احول الليبل الاول للون الاخضر وبعد ثانية واحدة الليبل الثاني والاول ايضا يتحول للاخضر وبعد ثانية الليبل الاول والثاني والثالث ثم بعد ثانيه يعودوا للون الاصفر ويبدؤوا من جديد بشكل دائم

كود :
Public Class Form1
   Dim tes As IntPtr
   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
       ElseIf tes = 20
           Me.Label2.ForeColor = System.Drawing.Color.Green

       ElseIf tes = 30
           Me.Label3.ForeColor = System.Drawing.Color.Green
       ElseIf tes = 40
           Me.Label1.ForeColor = System.Drawing.Color.Yellow
           Me.Label2.ForeColor = System.Drawing.Color.Yellow
           Me.Label3.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()
   End Sub
End Class
 بارك الله فيك اخي الكريم و جزاك كل خير
كنت بصدد العمل على نفس الفكرة و لكن بشكل مختلف فهل ممكن اللون الاخضر ينتقل تباعا في كل مرة اي ليبل واحد اخضر
في كل مرة لعدد غير محدد لليبل اكون شاكر ... وبارك الله فيك مرة اخرى
الرد }}}
تم الشكر بواسطة:
#4
(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
قال صلى الله عليه وسلم: 
«كلمتان خفيفتان على اللسان 
ثقيلتان في الميزان،حبيبتان إلى الرحمن: 
سبحان الله وبحمده، سبحان الله العظيم».
الرد }}}
#5
(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
بارك الله فيك
الرد }}}
تم الشكر بواسطة: Taha Okla , عماد سلمان منذر
#6
(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 ObjectAs EventArgsHandles MyBase.Load
        Timer1
.Start()
 
   End Sub

    Private Sub Timer1_Tick
(sender As ObjectAs EventArgsHandles Timer1.Tick
        Dim lbls 
As Label() = New Label() {Label1Label2Label3Label4Label5Label6Label7Label8Label9Label10Label11Label12}
 
       Static idx As Integer 'لاخذ رقم او اندكس النص من القائمة
        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 
'للبدء من جديد
        End If
    End Sub
End Class 
الرد }}}



التنقل السريع :


يقوم بقرائة الموضوع: