Originally posted by Luckeyy
You must login or register to view this content.
Hi NGU Babies!!
Today i am gonna teach you guys how to create a cool " Scrollbar " on your RTM applications.
Things you will need before proceeding.
Visual Studios
Brain
Instructions designing " Scrollbar " C#
Step 1. Open up " Visual Studios "
Step 2. You will need " Timer, Panel & Label "
You must login or register to view this content.
You must login or register to view this content.
Step 3. Now under " public partial class Form1 : Form " type in " int xCounter = 0;
You must login or register to view this content.
Step 4. Now in your timer enter this coding
**Note** Set your timer interval to your preference. I use " 5 "
You must login or register to view this content.
Step 5. Now that we coded our timer, Let's make a " private void Scrollbar() "
You must login or register to view this content.
Step 6. Under " InitializeComponent(); " your gonna code " Scrollbar(); to declare the private void you just created.
You must login or register to view this content.
Step 7. Start up your application. If everything was done correctly it should turn out like this
You must login or register to view this content.
Scrollbar Tutorial Source
You must login or register to view this content.
Virus Scan
You must login or register to view this content.
Well i hope you all enjoyed my tutorial. I uploaded my tutorial source for educational purposes, If care to use this in your application (RTM) please leave credits.
or you could simple do something like this
public void NewsBar(Label lbl, String Text, int Speed = 50, Boolean State = true)
{
System.Windows.Forms.Timer NewsTimer = new System.Windows.Forms.Timer();
if (State) NewsTimer.Start(); else NewsTimer.Stop();
NewsTimer.Interval = Speed;
NewsTimer.Tick += (a, b) =>
{
lbl.Text = Text;
lbl.Location = new Point(lbl.Location.X - 5, lbl.Location.Y);
if (lbl.Location.X < -100)
{ lbl.Location = new Point(this.Width - lbl.Width + 100, lbl.Location.Y); }
};
}
Now with this, you can simply do multiple Labels, as its creating a new instance of a Timer
NewsBar(label1, "This is an Example News Bar..");
Want to disable it? its simple, you can simply use a Checkbox for the last param, to check the state to true / false
NewsBar(lable1, "This is an Example News Bar #2..", 50, checkBox1.Checked);
Anyways, Nice work man. Should help some people out