C # screen rendering program

Source: Internet
Author: User

A few days ago, the customer asked the customer to display some prompts on the screen, while also considering the problem of screen refresh when the customer made the transaction, the scrolling information cannot start again after the screen refresh, instead, the operation before refresh continues.
In this way, you will not be able to use the Javascript Trojan [marquee] effect. In order notProgramI had to write a plug-in to display scrolling subtitles. The source code is published to make it easy for users who need the same resources.
Note the following points for the program design:
(1) override createparams should be used to create a form.

View code

 Protected     Override  Createparams
{
Get
{
Createparams CP = Base . Createparams;
CP. exstyle | = Zero X 8000000 ; // Make it inactive at creation
Return CP;
}
}

(2) set form attributes during creation

View code

   // Set form attributes  
This . Backcolor = Color. Fuchsia;
This . Transparencykey = Color. Fuchsia;
This . Topmost = True ; // PIN to top
// This. windowstate = formwindowstate. maximized;
This . Showintaskbar = False ; // Cancel display in the taskbar
This . Formborderstyle = Formborderstyle. None; // Undo title bars, borders, etc.
// This. startposition = formstartposition. centerscreen; // Form position

(3) consider the problem of multiple screens.

View code

   ///     <Summary> 
/// Display on the main screen
/// </Summary>
Private Void Positiononsecondaryscreen ()
{
Screen secondaryscreen = Null ;
If (Screen. allscreens. Length = 1 )
{
Secondaryscreen = Screen. primaryscreen;
}
Else
{

Foreach (Screen Screen In Screen. allscreens)
{
If (Screen. Primary = False )
{
Secondaryscreen = Screen;
Break ;
}
}
}

This . Location = Secondaryscreen. workingarea. location;
This . Size = Secondaryscreen. workingarea. size;

}

The screen draw character is actually very simple, that is, drawstring at the specified position, but it is best to calculate the length of the character to be drawn by measurestring before drawing

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.