Windows of mobile prompt information similar to MSN implemented by winform

Source: Internet
Author: User
Some software will display a prompt form at a specific time. This form is not directly displayed, but gradually moved up from the bottom of the window until the form is completely displayed. After clicking the "OK" button, the form gradually moves down from the screen until it is completely invisible from the screen. This is also one of the effects of the form discussed in this article: The Mobile Prompt window implemented by winform.
Each control class has a location attribute, which is a point value. This value indicates the coordinate value in the upper left corner of the control. With this coordinate value, we can set the position of the form. Program Core Code As follows:
Using system;
Using system. Collections. Generic;
Using system. componentmodel;
Using system. Data;
Using system. drawing;
Using system. text;
Using system. Windows. forms;
Namespace threaddemo
{
/// <Summary>
/// Note: this is the information Prompt window. When you run the program, the window will slowly jump from the bottom of the screen
/// Move up. The Prompt window is displayed completely;
/// When the "OK" button is clicked, the window will be slowly removed from the screen area.
/// </Summary>
Public partial class noteform: Form
{
Private int screenwidth; // screen width
Private int screenheight; // screen height
Private bool finished = false; // whether the prompt window is fully displayed
Public noteform ()
{
Initializecomponent ();
Screenheight = screen. primaryscreen. bounds. height;
Screenwidth = screen. primaryscreen. bounds. width;
// Set the prompt window coordinate outside the area that can be displayed on the screen
Location = new point (screenwidth-width, screenheight );
}
Private void noteform_load (Object sender, eventargs E)
{
}
Private void timereffectick (Object sender, eventargs E)
{
If (! Finished) // If the prompt window is not fully displayed
{
// If the sum of the Y coordinate of the prompt window and the height of the prompt window is greater than the screen height
If (location. Y + height> = screenheight)
{
Location = new point (location. X, location. Y-5 );
}
}
Else // If the prompt window is displayed, click OK.
{
// If the prompt window does not completely disappear from the screen
If (location. Y <screenheight)
{
Location = new point (location. X, location. Y + 5 );
}
}
}
Private void btnok_click (Object sender, eventargs E)
{
// The display is completed so that the prompt control is removed from the display area.
Finished = true;
}
}
}
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.