hi,
i am currently working with forms.i hav created a login page ,administrator page form and one more form.i want a text to be flying(scrolling) in the 3rd form and it must be updated from the administrator page form.how shall i do??????????
kindly suggest me!!!!!!!!!!
Loading
theLizardPosted Jan 10, 2010, 3:18 AM
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
string marqueeText = "private void button1_Click(object sender, EventArgs e)";
float posX = 0.0f;
int pos = 0;
string marquee = "";
System.Drawing.Graphics formGraphics = null;
System.Drawing.Font drawFont = new System.Drawing.Font("Tahoma", 16);
System.Drawing.SolidBrush drawBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
posX = this.Width;
formGraphics = this.CreateGraphics();
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Enabled = true;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (pos != marqueeText.Length)
{
marquee += marqueeText[pos];
DrawString(marquee, posX );
posX--;
pos++;
}
else
{
if (marquee.Length > this.Width + 1)
marquee = marquee.Substring(1);
marquee += " ------ ";
pos = 0;
}
if (posX == 0.0f)
{
pos = 0;
}
}
private void DrawString(string s, float pos)
{
float x = pos;
float y = 50.0f;
formGraphics.Clear(this.BackColor);
formGraphics.DrawString(s, drawFont, drawBrush, x, y);
//drawFont.Dispose();
//drawBrush.Dispose();
//formGraphics.Dispose();
}
}
}
theLizardPosted Jan 14, 2010, 11:38 PM
Features:
Get and Set for;
MarqueeText
ScrollEnabled
ScrollTextColor
Shadow
ShadowColor
ShadowOffsetX
ShadowOffsetY
plus
Font size and font family changed
Auto re size of user control on font size change
:)
Sam HobbsPosted Jan 13, 2010, 2:44 PM
dhilipan nairPosted Jan 10, 2010, 7:09 AM
Sam HobbsPosted Jan 9, 2010, 11:14 PM
Sam HobbsPosted Jan 9, 2010, 2:52 PM
Th reason I ask if it is a desktop application is because there is a marquee control for HTML that probably does what you need to do.
If you search for marquee then you will find articles and such.
dhilipan nairPosted Jan 9, 2010, 9:26 AM
i am currently using 3 forms.
1)login form2)administator page3)a form to register attendance.
i want important news to be scrolling in the 3rd form,whenever it is loaded.and that text must be updatable by the 2nd form.
dhilipan nairPosted Jan 9, 2010, 9:25 AM
i am currently using 3 forms.
1)login form2)administator page3)a form to register attendance.
i want important news to be scrolling in the 3rd form,whenever it is loaded.and that text must be updatable by the 2nd form.
Sam HobbsPosted Jan 9, 2010, 2:19 AM
Please do make your questions bigger with more details. You need to provide details such as the type of project; is this a web form or a desktop form?