Scroll subtitle (C #)

Source: Internet
Author: User

Using system;
Using system. collections;
Using system. componentmodel;
Using system. drawing;
Using system. Data;
Using system. Windows. forms;
Namespace caster
{
/// <Summary>
/// Summary of mymovechar.
/// </Summary>
Public class mymovechar: system. Windows. Forms. usercontrol
{
Private system. Windows. Forms. Timer timer;
Private system. Windows. Forms. Label label;
Private system. componentmodel. icontainer components;
Public mymovechar ()
{
// This call is required by the windows. Forms Form Designer.
Initializecomponent ();
Timer. Tick + = new eventhandler (timer_tick );
// Todo: add any initialization after initializecomponent calls
}
/// <Summary>
/// Clear all resources in use.
/// </Summary>
Protected override void dispose (bool disposing)
{
If (disposing)
{
If (components! = NULL)
{
Components. Dispose ();
}
}
Base. Dispose (disposing );
}
# Code generated by the region component designer
/// <Summary>
/// The designer supports the required methods-do not use the code editor
/// Modify the content of this method.
/// </Summary>
Private void initializecomponent ()
{
This. components = new system. componentmodel. Container ();
This. Label = new system. Windows. Forms. Label ();
This. Timer = new system. Windows. Forms. Timer (this. components );
This. suspendlayout ();
//
// Label
//
This. Label. autosize = true;
This. Label. Location = new system. Drawing. Point (320, 0 );
This. Label. Name = "label ";
This. Label. size = new system. Drawing. Size (0, 17 );
This. Label. tabindex = 0;
//
// Timer
//
This. Timer. Enabled = true;
//
// Mymovechar
//
This. Controls. Add (this. Label );
This. Name = "mymovechar ";
This. size = new system. Drawing. Size (320, 32 );
This. resumelayout (false );
}
# Endregion
# Region propertys
Public new system. Drawing. Size size
{
Get
{
Return base. size;
}
Set
{
Base. size = value;
Label. Location = new system. Drawing. Point (Label. Location. X, (size. Height-label.Size.Height)/2 );
}
}
Public override system. Drawing. Font font
{
Get
{
Return base. Font;
}
Set
{
Base. font = value;
Label. font = value;
}
}
Public override string text
{
Get
{
Return label. text;
}
Set
{
Label. Text = value;
Label. Location = new system. Drawing. Point (this. Size. Width, label. Location. y );
}
}
Public override system. Drawing. Color forecolor
{
Get
{
Return base. forecolor;
}
Set
{
Base. forecolor = value;
Label. forecolor = value;
}
}
Public override system. Drawing. Color backcolor
{
Get
{
Return base. backcolor;
}
Set
{
Base. backcolor = value;
Label. backcolor = value;
}
}
Public int Interval
{
Get
{
Return timer. interval;
}
Set
{
Timer. interval = value;
}
}
# Endregion
Private void timer_tick (Object sender, eventargs E)
{
If (Label. Location. x + label. Size. width)> 0)
Labels. Location = new system. Drawing. Point (Label. Location. X-1, label. Location. y );
Else
Label. Location = new system. Drawing. Point (this. Size. Width, label. Location. y );
}
}
}

 

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.