In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how to use C # to achieve MSN Messenger window". In daily operation, I believe many people have doubts about how to use C # to achieve MSN Messenger window. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "how to use C # to achieve MSN Messenger window". Next, please follow the editor to study!
Sample diagram of effect
To implement the window of C # MSN Messenger, create a Windows Application, and then place a Button in the main form, as shown below:
The second step in the implementation of the window of C # MSN Messenger is to add a form (Form2) to the Application, set the FormBorderStyle property of the form to None (borderless mode), then set the TopMost property (always at the top) to True, set the ShowInTaskbar property (whether to display the form in the Windows taskbar) to False, and add the text you intend to display on the form (it is usually dynamically loaded in the program in practical applications) Set the background of the form to the picture you want and the appropriate size. * add three more Timer controls, in which timer1 controls the animation of the form's roll-out, timer2 controls the form's residence time, and timer3 controls the form's roll-in animation, setting their Interval property to 10. See the following figure
The third step in the implementation of the window of C # MSN Messenger is to write code to add two properties in Form2 to set the display size of the form:
Private int heightMax, widthMax; public int HeightMax {set {heightMax = value;} get {return heightMax;}} public int WidthMax {set {widthMax = value;} get {return widthMax;}}
Add a public method for ScrollShow:
Public void ScrollShow () {this.Width = widthMax; this.Height = 0; this.Show (); this.timer1.Enabled = true;}
Add a StayTime property to set the form dwell time (default is 5 seconds):
Public int StayTime = 5000
Add ScrollUp and ScrollDown methods to write how the form rolls out and in:
Private void ScrollUp () {if (Height
< heightMax) { this.Height += 3; this.Location = new Point(this.Location.X, this.Location.Y - 3); } else { this.timer1.Enabled = false; this.timer2.Enabled = true; } } private void ScrollDown() { if(Height >3) {this.Height-= 3; this.Location = new Point (this.Location.X, this.Location.Y + 3);} else {this.timer3.Enabled = false; this.Close ();}}
Write in the Tick methods of the three Timer:
Private void timer1_Tick (object sender, System.EventArgs e) {ScrollUp ();} private void timer2_Tick (object sender, System.EventArgs e) {timer2.Enabled = false; timer3.Enabled = true;} private void timer3_Tick (object sender, System.EventArgs e) {ScrollDown ();}
Initialize the form variable in the Load event of Form2:
Private void Form2_Load (object sender, System.EventArgs e) {Screen [] screens = Screen.AllScreens; Screen screen = screens [0]; / / get the screen variable this.Location = new Point (screen.WorkingArea.Width-widthMax-20, screen.WorkingArea.Height-34); / / WorkingArea is the workspace of the Windows desktop this.timer2.Interval = StayTime;}
Well, this is the end of the code for scrolling the form. Of course, it only implements a relatively simple scrolling out effect of the form, and how to apply it should also be completed with your program. Of course, you can add more features to it, such as displaying from anywhere on the form (here only from the lower right corner), fading in and out, plus sound, and so on. The most commonly used is to write a tray program, and then use this reminder effect.
Let's go back to Form1 and test the effect by writing the following code in the Click event of Button:
Private void button1_Click (object sender, System.EventArgs e) {Form2 form = new Form2 (); form.HeightMax = 120 new Form2 / height of form scrolling form.WidthMax = 148 hand / width of form scrolling form.ScrollShow ();} at this point, the study on "how to use C# to achieve MSN Messenger window" is over, hoping to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.