By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,370 Members | 1,188 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,370 IT Pros & Developers. It's quick & easy.

Help with a custom control using images

P: 2
I'm trying to create a simple custom control that displays an animation composed of separate image files. However, I'm having trouble with how exactly I use the imported images with the control. When I try to add the custom control to my other project, an error message pops up telling me the file could not be found. I placed the images being used in the same directory in each project, yet I still get this error. Does anyone have an idea on how I could accomplish this? Thanks in advance.

Here's the code I'm trying to get working:

SkullControl(void)
{
InitializeComponent();

images->Add( Image::FromFile( String::Concat( "Images/skull1.gif" )));
images->Add( Image::FromFile( String::Concat( "Images/skull2.gif" )));

pictureBox1->Image = dynamic_cast< Image^ >(images->default[0]);
}

Then heres the timer event code:

private: System::Void timer1_Tick(System::Object^ sender, System::EventArgs^ e) {
count = (count + 1) % 2;
pictureBox1->Image = dynamic_cast< Image^ >( images->default[count] );
}

As you can see, it's just a very simple animation, but one of the requirements for this project is a custom control and I couldn't think of anything else to make using one. I just need to know how to implement those images so that they will work when the control is added to the other form. Does it have something to do with adding them to the resources or something?
May 20 '07 #1
Share this Question
Share on Google+
1 Reply


P: 2
Please, I really need some help here, I've ran out of ideas on what to do with this.
May 20 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.