how can I do animation on ToggleButton

6 posts, 0 answers
  1. Mark Brown
    Mark Brown avatar
    5 posts
    Member since:
    Dec 2006

    Posted 09 Feb 2008 Link to this post

    I want to add animation gif to toggle button. Is it possible?
  2. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 11 Feb 2008 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Mark Brown
    Mark Brown avatar
    5 posts
    Member since:
    Dec 2006

    Posted 11 Feb 2008 Link to this post

    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 :(

  5. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 11 Feb 2008 Link to this post

    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
  6. Jorge Delgado-Lopez
    Jorge Delgado-Lopez avatar
    82 posts
    Member since:
    Aug 2007

    Posted 15 Jul 2008 Link to this post

    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
  7. Peter
    Admin
    Peter avatar
    1148 posts

    Posted 16 Jul 2008 Link to this post

    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
Back to Top
UI for WinForms is Visual Studio 2017 Ready