0

Hi,

I have 2 backgroundpictures that I want to change every second in a loop.
I beleive a backgroundworker and reportproress will work for this.

But what I wonder is about these 2 pictures themselves. Normally you can compile a project with a one backgroundpicture put to the buttoncontrol but how will this work if I will need to change between 2 pictures each second.

I dont want to use pathes on a users computer like C:\\ etc...
Is it possible to have the compiled in the project and call these in any way ?

(Inside a backgroundworker)

private: System::Void backgroundWorker1_DoWork(System::Object^  sender, System::ComponentModel::DoWorkEventArgs^  e) 
{
  while( true )
  {	
      Thread::Sleep(1000);
      backgroundWorker1->ReportProgress(0); 
  }
}

private: System::Void backgroundWorker1_ProgressChanged(System::Object^  sender, System::ComponentModel::ProgressChangedEventArgs^  e) 
{
	if( button1->BackgroundImage == "Path1" )
	{
		button1->BackgroundImage = "Path2";
	}
	else
	{
		button1->BackgroundImage = "Path1";
	}
}
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by jonsca
0

I have done this in C# but it seems to be a bit different in C++/CLI. I found this page which describes a method but I don't know if it's the most effective.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.