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";
	}
}

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.