PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Animated Window Effects with "Toast" Popup Demo-VBForums
Results 1 to 5 of 5

Thread: Animated Window Effects with "Toast" Popup Demo

  1. #1

    Thread Starter
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,724

    Animated Window Effects with "Toast" Popup Demo

    VB version here.

    FormAnimator class - A helper class that you can add an instance of to a form to provide animation when the form is shown, hidden or closed. Supported animations are Roll (form is unrolled and rolled up from one edge to the opposite), Centre (form unrolls from the centre out and rolls up from all edges in), Slide (form slides in and out from one edge to the opposite) and Blend (form fades in and out). Roll and Slide animations can be up, down, left, right or diagonal. To use this class just add a single line of code similar to this to your form:
    CSharp Code:
    1. private FormAnimator animator;
    2.  
    3. public Form1()
    4. {
    5.     InitializeComponent();
    6.  
    7.     this.animator = new FormAnimator(this,
    8.                                      FormAnimator.AnimationMethod.Slide,
    9.                                      FormAnimator.AnimationDirection.Up,
    10.                                      400);
    11. }
    NOTE: The C# Toast demo will be here soon. Watch this space.
    Attached Files Attached Files

  2. #2

    Thread Starter
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,724

    "Toast" Popup Demo

    The attached project includes a ToastForm class that uses the FormAnimator class from above to create a popup notification in the lower, right-hand corner of the screen, just above the system tray, as many commercial applications do. You can import this class into your own project as is or create your own using the same pattern.

    To see the demo in action, run the attached project and click the Button on the main form several times. You'll see notification windows stack themselves up from the bottom, right-hand corner of the screen. As a new notification window slides up it pushes any existing windows further up the screen.

    The notification windows are each a random height and will remain displayed for a random time period. As a window slides out of view again any windows above it will fall down to fill the vacant space.

    The last point to note is that the notification window will not take focus when it's first displayed, but if you click it it will be activated.

    Edit: 27-Nov-2008
    Set the TopMost property of the ToastForm class to True to ensure notification windows were not hidden behind other windows if the caller is not currently active.
    Attached Files Attached Files
    Last edited by jmcilhinney; Nov 26th, 2008 at 10:39 PM.

  3. #3
    New Member
    Join Date
    Aug 2009
    Posts
    1

    Re: Animated Window Effects with "Toast" Popup Demo

    We've been trying to adapt your code so I can use it on a socket programming application I am currently working on.

    The problem is that the toastform stops working and will not be able to close it, is there a possibility that the timer is creating the problem?

    Here's a sample of the code I did
    Code:
    if( nBytesRec > 0 )
    				{
    					// Wrote the data to the List
    					string sRecieved = Encoding.ASCII.GetString( m_byBuff, 0, nBytesRec );
    
    					// WARNING : The following line is NOT thread safe. Invoke is
    					// m_lbRecievedData.Items.Add( sRecieved );
    					Invoke( m_AddMessage, new string [] { sRecieved } );
                        sliceCount += 1;
    
                        Form_Animation_and_Toast_Demo.ToastForm slice = new Form_Animation_and_Toast_Demo.ToastForm(this.rng.Next(2000, 10000), sRecieved);
    
                        slice.Height = this.rng.Next(50, 200);
                        slice.Show();
    					// If the connection is still usable restablish the callback
    					SetupRecieveCallback( sock );
    				}

  4. #4
    New Member
    Join Date
    Jun 2019
    Posts
    1

    Re: "Toast" Popup Demo

    Quote Originally Posted by jmcilhinney View Post
    The attached project includes a ToastForm class that uses the FormAnimator class from above to create a popup notification in the lower, right-hand corner of the screen, just above the system tray, as many commercial applications do. You can import this class into your own project as is or create your own using the same pattern.
    What is the licence on the project?

  5. #5

    Thread Starter
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,724

    Re: "Toast" Popup Demo

    Quote Originally Posted by bobob View Post
    What is the licence on the project?
    I've never gone to the effort of determining which license to officially apply to the stuff I post in the CodeBank forum and the like. As long as you don't try to expressly claim it as your own, I'm happy for you to do whatever you want with it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width