6 Replies - 15307 Views - Last Post: 18 October 2007 - 11:36 AM Rate Topic: -----

#1 aNiXtEr   User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 08-February 07

Creating a flashing screen

Posted 17 August 2007 - 07:29 PM

I have been creating a program for my poker buddies that has a countdown clock. I was trying to figure out how to signal the clock stopping. Then I thought of using a flashing screen to signal the end. Any thoughts on how to do this as I have tried and when put into a loop, it goes too quickly. I thought of using a timer to slow down the background changing. Any suggestions?
Is This A Good Question/Topic? 0
  • +

Replies To: Creating a flashing screen

#2 PsychoCoder   User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1663
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: Creating a flashing screen

Posted 17 August 2007 - 09:11 PM

Tie it to a Timer Control, then set the interval of the timer to your desired rate.
Was This Post Helpful? 0
  • +
  • -

#3 WestSideRailways   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 23-February 07

Re: Creating a flashing screen

Posted 13 October 2007 - 04:11 PM

I would like to do the same thing :)
can you point me in the direction to do this. :D
Was This Post Helpful? 0
  • +
  • -

#4 aceofspades686   User is offline

  • D.I.C Regular
  • member icon

Reputation: 6
  • View blog
  • Posts: 334
  • Joined: 08-October 07

Re: Creating a flashing screen

Posted 13 October 2007 - 10:07 PM

Working with the Timer Control in VB.NET

That tutorial explains fairly well how to use the timer control for VB.NET.

Use that, and change the backcolor and/or forecolor property of whatever you want to flash to change with your timer_tick.
Was This Post Helpful? 0
  • +
  • -

#5 Shadow 1.2   User is offline

  • D.I.C Head
  • member icon

Reputation: 7
  • View blog
  • Posts: 70
  • Joined: 17-October 07

Re: Creating a flashing screen

Posted 18 October 2007 - 10:02 AM

Here I got bored and tried to make some code for you. Ive Made it in visual basic 2005 express edition so it should work.
Components
-Timers
--Flasher1
--Flasher2
--Countdown
-Variables
--time
--flash
-Other
--label1
Public Class Form1
	Public time As Long
	Public flash As Boolean
	Private Sub Flasher1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Flasher1.Tick
		If flash = False Then
			flash = True

			Me.BackColor = Color.White
		End If
		flasher2.Enabled = True
	End Sub

	Private Sub Flasher2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles flasher2.Tick
		If flash = True Then
			Me.BackColor = Color.Black
			flash = False
		End If

	End Sub

	Private Sub Countdown_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Countdown.Tick
		time = time + 1
		Countdown.Enabled = True
		Label1.Text = time
		If time = 6 Then
			Flasher1.Enabled = True
			Label1.Hide()

		End If
	End Sub
End Class


once the time = 5 the screen will start flashing black and white
hope it works

Ps. im 13 so if the code sucks sorry
Was This Post Helpful? 0
  • +
  • -

#6 aceofspades686   User is offline

  • D.I.C Regular
  • member icon

Reputation: 6
  • View blog
  • Posts: 334
  • Joined: 08-October 07

Re: Creating a flashing screen

Posted 18 October 2007 - 10:44 AM

Hm, interesting way of going about it Shadow 1.2. Though perhaps a bit overly complex, this would be handy if you wanted the form to flash in different increments (say white for 2 seconds, black for 1).

Here's how I personally would've done it just to show you how it can be done with one timer (not including the countdown timer).

Private Sub tmrFlash_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrFlash.Tick
   If Me.BackColor = Color.Black Then
	  Me.BackColor = Color.White
   ElseIf Me.BackColor = Color.Black Then
	  Me.BackColor = Color.White
   Else
	  Me.BackColor = Color.White
   End If
End Sub

Then, when you want the form to start flashing (probably based off the countdown timer in this instance) you would just enable this timer.

Just food for thought on a simpler way to do it with the same timer interval for both changes.
Was This Post Helpful? 0
  • +
  • -

#7 Shadow 1.2   User is offline

  • D.I.C Head
  • member icon

Reputation: 7
  • View blog
  • Posts: 70
  • Joined: 17-October 07

Re: Creating a flashing screen

Posted 18 October 2007 - 11:36 AM

View Postaceofspades686, on 18 Oct, 2007 - 10:44 AM, said:

Hm, interesting way of going about it Shadow 1.2. Though perhaps a bit overly complex, this would be handy if you wanted the form to flash in different increments (say white for 2 seconds, black for 1).

Here's how I personally would've done it just to show you how it can be done with one timer (not including the countdown timer).

Private Sub tmrFlash_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrFlash.Tick
   If Me.BackColor = Color.Black Then
	  Me.BackColor = Color.White
   ElseIf Me.BackColor = Color.Black Then
	  Me.BackColor = Color.White
   Else
	  Me.BackColor = Color.White
   End If
End Sub

Then, when you want the form to start flashing (probably based off the countdown timer in this instance) you would just enable this timer.

Just food for thought on a simpler way to do it with the same timer interval for both changes.

I thought the code got a bit long, thanks for the correction
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1