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