This is a migrated thread and some comments may be shown as answers.

how can I do animation on ToggleButton

5 Answers 167 Views
Buttons, RadioButton, CheckBox, etc
This is a migrated thread and some comments may be shown as answers.
Mark Brown
Top achievements
Rank 1
Mark Brown asked on 10 Feb 2008, 12:10 AM
I want to add animation gif to toggle button. Is it possible?

5 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 11 Feb 2008, 08:08 AM
Hello Mark Brown,

Thank you for writing.

You could add a image (animated gif) to RadToogleButton using the Image property.

radToggleButton1.Image = Image.FromFile(@"..\MyImage.gif");

Maybe you will need additional functionality to change the Image when the ToggleState changes.
To do this you should subscribe for the ToggleStateChanging event and use the code below.

private void radToggleButton6_ToggleStateChanging(object sender, Telerik.WinControls.UI.StateChangingEventArgs args)
{
            if (!radToggleButton1.IsChecked)
            {
                    radToggleButton1.Image = Image.FromFile(@"..\OnImage.gif");
            }
            else
            {
                    radToggleButton1.Image = Image.FromFile(@"..\OffImage.gif");          
            }
}


I hope this helps.

Best wishes,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mark Brown
Top achievements
Rank 1
answered on 11 Feb 2008, 12:35 PM

System.Reflection.

Assembly thisExe = System.Reflection.Assembly.GetExecutingAssembly();

System.IO.

Stream file = thisExe.GetManifestResourceStream("WindowsApplication1.img.loading.gif");

radToggleButton1.Image =

Image.FromStream(file);


not animated :(

0
Peter
Telerik team
answered on 11 Feb 2008, 03:03 PM
Hi Mark Brown,

Sorry for misunderstanding.

The animated GIF functionality is not supported in the version of our product you are using. Animated GIF support was added in RadControls for Winforms Q3 2007. Please use this version of our controls to take advantage of this functionliaty.

Please let us know if you have any additional questions.

Sincerely yours,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
superold
Top achievements
Rank 1
answered on 15 Jul 2008, 06:34 PM
Hi.

I have the following

public class SearchButton : RadButton
{
public SearchButton() 
{
this.AutoSize = false;
this.Image = gobal::test.Properties.Resources.search;
this.Size = new System.Drawing.Size(75, 23);
this.ImageAlignment = System.Drawing.ContentAlignment.MiddleCenter;
}

public void Wait()
{
// waiting is an animated gif
this.Image = gobal::test.Properties.Resources.waiting;
this.Invalidate(true);
}

public void Reset()
{
this.Image = gobal::test.Properties.Resources.search;
this.Invalidate(true);
}
}

When I set the waiting animated gif it does work the first time, then I reset it to a non animated gif, the second time I set the image to the animated gif it animates for a brief moment and it stops. And it never plays again.

Any ideas?
-j
0
Peter
Telerik team
answered on 16 Jul 2008, 11:28 AM
Hello Jorge Delgado-Lopez,

Thank you for writing.

We are aware of this issue and it will be fixed in Q2 2008 release next week.

Your Telerik points have been updated.

All the best,
Peter
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Buttons, RadioButton, CheckBox, etc
Asked by
Mark Brown
Top achievements
Rank 1
Answers by
Peter
Telerik team
Mark Brown
Top achievements
Rank 1
superold
Top achievements
Rank 1
Share this question
or