I'm using XP SP2. Perhaps that's an issue, but I don't see why. I doubt the AnimateWindow API was changed at all with the update, but I suppose there might be some reason. The question is, why haven't you installed SP2 yet? Slacker! :)
Printable View
I'm using XP SP2. Perhaps that's an issue, but I don't see why. I doubt the AnimateWindow API was changed at all with the update, but I suppose there might be some reason. The question is, why haven't you installed SP2 yet? Slacker! :)
Aside from you have SP2, do you have any clues why it doesn't run on some machines? How about providing us an installer for it? :)
I have no clue what the issue might be and I can't see how an installer could make a difference. Have you tried compiling a release build and running that? Do you get the same exception if you do? The only other thing I can suggest is to create your own project from scratch. You could then generate new class files in the IDE and either write the code yourself or copy and paste it from the old files. I don't really see why this would make a difference, but then I don't see why there's an issue in the first place.
Ok, I'll try your suggestions later and will return to give a feedback...
It appears that the issues that some have been having are due to a bug in the Framework that was fixed in SP1, so apply SP1 for the .NET Framework 1.1 and all should be well.
Hi all,
anyone knows whether this is also working with .net 2.0?
The classes and project (I think that's what's in the ZIP file but it's been a while) that I've provided were created in VS.NET 2003. There's nothng in there that wouldn't work in .NET 2.0 though. You should just be able to open the project in VS 2005 and have it converted. I think you'll find that you could also add those class files to a project as Existing Items exactly as they are.Quote:
Originally Posted by K321
Thanks for the fast response. Question was more about the .net 2.0 instead of VS 2005. I still use VS 2003 and .net 1.1 but I wonder whether users with .net 2.0 might still be able to get my program running then. I've read about the bug with .net 1.1 which was fixed in SP1 so maybe someone already uses this on .net 2.0 before I add this to my program?
.NET 2.0 is not just an update to the Framework that everyone should use. Version 2.0 of the Framework is only for applications written with VS 2005. VS.NET 2003 is only capable of targeting versions 1.0 and 1.1. Anyone using an application that you write using VS.NET 2003 should be installing version 1.1 of the Framework, even if they have version 2.0 installed already. Most apps written for version 1.1 will still run if only version 2.0 is present but there is no guarantee. Again, version 2.0 is not just an update for users of version 1.1. It is intended for users of applications written with VS 2005.
Yeah, I guess most users with 2.0 will also still have 1.1, you're right. As far as I remember .net 1.1 is automatically installed even if you only install VS 2005 so I could assume that everyone has .net 1.1 currently, right? At least before Vista comes, don't know how it is handled there....
Thanks!!
VS.NET 2002 is built on and installs version 1.0 of the Framework. VS.NET 2003 is built on and installs version 1.1 of the Framework. VS 2005 is built on and installs version 2.0 of the Framework. You should supply a link, at the very least, that your users can use to download the correct version for the app you are supplying. If you have apps on your machine built with all three version of VS.NET then you should have all three versions of the Framework installed too. Only Windows Server 2003 comes with a the Framework as standard. Everyone else has to install it themselves. Vista will come with version 2.0 as standard. Previous versions would still need to be installed for apps written with earlier versions of VS.NET. Those apps will use version 2.0 if that's all that's available and most will work without issue, but there is no guarantee.
Sir this is in 2003 so what about the 2005.
Thanks
The FormAnimator class should work as is. The ToastForm is just a form, so you can create your own in VB 2005 and then add the same custom code as I did in before.Quote:
Originally Posted by shakti5385
I think there is no FormAnimator class as you suggest.
FormAnimator class
The FormAnimator class is one that I wrote myself and it's attached to the first post this thread. It was the whole point of this thread. Hit yourself over the head with something heavy and say "D'oh", then blush furiously.Quote:
Originally Posted by shakti5385
;) :DQuote:
Originally Posted by jmcilhinney
Dear John,
How can change the form show style as disolving ?
Dana
No idea.Quote:
Originally Posted by danasegarane
Dear Jhon,
I think you have misunderstand.During form unload you have given one method as disolve.Is there any method aval to show the form during load event
thnks
Dana
I don't know what you mean. There are four effects supported by AnimateWindow: Roll, Centre, Slide and Blend. All four are supported on both loading and closing.Quote:
Originally Posted by danasegarane
Dear Jhon,
I want to show the form like a blend. Is this posible ?
Yes it is, and the very first paragraph of the very first post of this thread explains how.Quote:
Originally Posted by danasegarane
I trying this method.
vb Code:
Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.m_activeDB = New FormAnimator(Me, _ FormAnimator.AnimationMethod.Blend, _ FormAnimator.AnimationDirection.Up, _ 1000) Dim mnumanger As New SystemMenuManager(Me, False, SystemMenuManager.MenuItemState.Disabled) End Sub Private Sub Form2_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing 'Close the form by sliding down. Me.m_activeDB.Direction = FormAnimator.AnimationMethod.Blend End Sub
This Gives a nice effect during the closing of the Form.But it not showing the
efffect during form load event.
Dana
1. I just tested the following code:and it worked fine for me.vb.net Code:
Public Class Form2 Private m_activeDB As FormAnimator Private Sub Form2_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.m_activeDB = New FormAnimator(Me, _ FormAnimator.AnimationMethod.Blend, _ FormAnimator.AnimationDirection.Up, _ 1000) End Sub End Class
2. You don't blend a form in any direction so there's no point using the FormAnimator constructor that takes a direction.
3. In your Closing event handler you're assigning an animation method to a property that is supposed to take an animation direction. Again, blending isn't done in any direction so setting one is pointless, but if you were going to set one you should at least use a value of the appropriate type. If that code doesn't throw a compilation error then you must have Option Strict turned Off. I suggest that you rectify that immediately.
nice work :afrog:
nice work jm...:thumb: :thumb: :thumb: :thumb:
[Basking in the glow of praise]Thank you, thank you.[/Basking in the glow of praise] ;)
Great work on the toastform class jmc! (1 more reason to bask in the glory of praise! :p )
But theres a little problem that i have encountered using this toastform.
I am using VBExpress 2005 (.NET 2.0).
All seems to be well till I try to declare and Show the form from a new thread. When I do that, the form is visible till the duration of the animation, but after that the form simply disappears. I even tried to debug it while setting a breakpoint at Me.Close() and lifeTimer.Tick, but the breakpoints are never hit! :rolleyes: . I have simply no idea where the form goes after it disappears. Two things I know for sure: The form never closes itself,and the lifeTimer.Tick event doesn't fire.
Some threading issue perhaps? or the Timer?
It seems that the Windows.Forms.Timer sticks to the UI thread only. So, the Timer.Tick event may not fire at all.
But on the other hand, the System.Timers.Timer is said to raise the Elapsed event on new threads from the ThreadPool every time it is raised. So, it throws an InvalidOperationException: "Cross-thread operation not valid: Control 'PopupNotifierForm' accessed from a thread other than the thread it was created on.", citing the (cross-thread) call to "Me.Close()" as invalid. Delegation didn't help either. That throws a NullReferenceException: "Object reference not set to an instance of an object".
This is the code I am trying to delegate the Me.Close method.
VB Code:
Public Delegate Sub FormCloseDelegate() Public Class ToastForm '... '... Public Sub FormClose() If Me.InvokeRequired Then Me.Invoke(New FormCloseDelegate(AddressOf FormClose)) 'Throws NullReferenceException: "Object reference not set to an instance of an object" Else Me.Close() End If End Sub End Class
Even Threading.Timer using the TimerCallback throws the same exception.
VB Code:
Private LifeTimerCallback as New TimerCallback(AddressOf lifeTimer_CallbackMethod) Private Sub ToastForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load '... Me.lifetimer = New Threading.Timer(Me.lifeTimerCallback, Nothing, lifetime, 0) End Sub '... Private Sub lifeTimer_CallbackMethod(obj as Object) Me.FormClose() 'If I use Me.Close instead, it throws a InvalidOperationException: "Cross-thread operation not valid: Control 'PopupNotifierForm' accessed from a thread other than the thread it was created on." End Sub
Am I doing anything wrong or is it just the way these things work? Is there no way to make the form work normally if instantiated and called from new threads?
Any help will be truly appreciated. :)
And jmc, THANX ONCE AGAIN FOR THIS BEAUTIFUL SOLUTION!!! :thumb:
Thanks for your code Jim. It's really great! When using the FormAnimator class everything works great. The only problem is that when my date time picker is displayed it's viewed as sunk down in the form and it lost it's blue border like my combo box has. Do you have any idea on how to fix that problem? is it a property on my date time picker? I tried to look for the border property on the date time picker and realized that wasn't there. Any help will be appreciated.
If you don't use the FormAnimator does that not happen? It sounds like it's not getting drawn using visual styles for some reason. If you minimise the form and restore it does it get drawn properly then?Quote:
Originally Posted by Tim Hadley
Yes you are correct. If I don't use the Form Animator everything works fine. Also, when I minimize the form it goes back to the original state. I also have a drop down combo box right above the date time picker and once it is dropped over the date time picker and restored the date time picker goes back to the original state as well.
I can't tell you exactly why but the DTP is obviously not getting drawn using visual styles the first time. A workaround would be to handle the form's Shown event (assuming .NET 2.0+) and call the DTP's Refresh method to force an immediate repaint. I guess the DTP may not look right during the animation but that's the best I've got for you I'm afraid.Quote:
Originally Posted by Tim Hadley
Thanks! That seemed to work just fine after the form loads. I did the form' shown event and did a me.refresh and that took care of the date time picker being drawn right. Thanks for all your help!
You shouldn't call Me.Refresh. That will redraw the entire form, which is not needed. If you read my post again you'll see I said call the Refresh method of the DateTimePicker, not the form. If the DTP is all that needs to be repainted then that's all you should repaint.Quote:
Originally Posted by Tim Hadley
Has there been any updates/replacements to this code since 2006 and the advent of framework3.5 ?
The principles in this thread use the Windows API, which hasn't changed in XP at least. I don't know if there's anything new in Vista on this front. .NET 3.5 includes no new functionality that can replace the unmanaged code so everything would be exactly the same.Quote:
Originally Posted by Xancholy
Can you please tell me which posting number contains the most updated code ?
Whenever I update attached files in one of my CodeBank threads I always attach it to the first post and replace the old code, unless I have a specific reason to do otherwise.
Best practice. My only request would be to please include a sample image of toast in action... thanks