منتدى فيجوال بيسك لكل العرب | منتدى المبرمجين العرب

نسخة كاملة : طريقة تغيير بون الخلفيه كل دقيققه
أنت حالياً تتصفح نسخة خفيفة من المنتدى . مشاهدة نسخة كاملة مع جميع الأشكال الجمالية .
السلام عليكم
انا جالس اسوي برنامج ساعه
بس بدي طريقة عشان يتغير لون الخلفية كل دقيقهيعني بدي الخلفيه تتغير لما يصير عقرب الثواني عند 60
مممممممممم ضروري ردو علي
PHP كود :
 Private Sub Timer1_Tick(sender As ObjectAs EventArgsHandles Timer1.Tick

        Dim colors 
As List(Of Color) = New List(Of ColorFrom {Color.BlueColor.RedColor.BlackColor.Orange}
 
       Dim current As Integer DateTime.Now.Minute
        Dim period 
As Integer current
        Dim index 
period Mod colors.Count
        Me
.BackColor colors(index)

 
   End Sub

    Private Sub Form1_Load
(sender As ObjectAs EventArgsHandles MyBase.Load
        Timer1
.Enabled True
        Timer1
.Start()
 
   End Sub 
يا ريت لو توضح اكثر

انا بدي تتغير لون الخلفية لما يصير عقرب الثواني بالساعه عند 60
يا اخوان وينكم <
الفكرة سهلة وهي اضافة مؤقت وتجعل قيمة الانترفال 1 وتكتب كود يتحقق من الثانية now.date.second
مش متاكد املائيا

جرب المثال هذا
PHP كود :
Public Class Form1
    Dim colors 
As New List(Of Color)
 
   Private Sub Timer1_Tick(sender As ObjectAs EventArgsHandles Timer1.Tick
        Label1
.Text TimeString
        If Now
.Second 0 Then
            Me
.BackColor colors(Int(Rnd() * 2))
 
       End If
 
   End Sub

    Private Sub Form1_Load
(sender As ObjectAs EventArgsHandles MyBase.Load
        colors
.Add(Color.Blue)
 
       colors.Add(Color.Green)
 
       colors.Add(Color.Red)
 
   End Sub
End 
Class 

هذا الكود المطلوب(حسب فهمي للطلب)
PHP كود :
Public Class Form1
    Dim colors 
As New List(Of Color)
 
   Private Sub Timer1_Tick(sender As ObjectAs EventArgsHandles Timer1.Tick
        Label1
.Text TimeString
        If Now
.Second 0 Then Timer2.Start()
 
   End Sub

    Private Sub Form1_Load
(sender As ObjectAs EventArgsHandles MyBase.Load
        Randomize
()
 
       colors.Add(Color.Blue)
 
       colors.Add(Color.Green)
 
       colors.Add(Color.Red)
 
   End Sub

    Private Sub Timer2_Tick
(sender As ObjectAs EventArgsHandles Timer2.Tick
        If Now
.Second 0 Then
            Me
.BackColor colors(Int(Rnd() * 2))
 
           Timer2.Stop()
 
       End If
 
   End Sub
End 
Class 
بارك الله فيك
ابداع + ذكاء =عضو رائع
يحتاج تجربة هذا الكود