C # imitating QQ and MSN message series I. Basic Principles
C # imitating QQ and MSN message Series 2. imitating the basic effect includes code
C # imitating QQ and MSN message Series 3. Achieving multiple prompts
C # imitating QQ and MSN message Series 4. Optimized bug Modification
C # imitating QQ and MSN message Series 5. Using only two time controls for improvement
1. modify content
1. error message for referencing the mail category
Cause: the point attribute belongs to the reference mail class.
Modification method:
Originally, the public point endpoint is used. The attribute is used to obtain the location where the next Prompt window appears.
Public Int Y
{
Get { Return This . Endpoint. Y ;}
}
Problem Solving
2. Each time when multiple prompts pop up, the height of each window from the second start is 2 pixels higher than that of the background.
Cause: the default value of Form height is 2.
So we have to wait until the form moves two pixels and start to synchronize the position and size of the form.
If ( This . Movecount > 2 )
{
This . Height ++ ;
}
3. High CPU usage when multiple windows are displayed at the same time
Cause: it may be a problem with the system. Windows. Forms. Timer control.
Replace all the controls with system. Threading. Timer.
Result: The problem is not solved, and sometimes an exception occurs when multiple threads call the form (the probability is not high)
Continue waiting for the cool to solve this problem
Ii. Induction of knowledge points
After completing this demo, you can learn the following knowledge points:
1. operating principle of Form position
2. Mutual call between windows
3. Usage of system. Threading. Timer includes start and end
4. asynchronous thread operation window content (you must write the invoke method for calling delegate and related controls)
Iii. Function summary and overall
1. implement multiple prompts and automatically determine the location of the next form based on the current active form
2. Hover the mouse over the form. When the mouse is over the form, the form stops motion and continues the current action after it leaves.
: WindowsMoveDemo2008-07-30.rar