outflow string

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • avigreen
    New Member
    • Jan 2010
    • 2

    outflow string

    i wrote a code
    Code:
    public partial class frmFlow : Form
        {
            string FineString = " ";
            PointF thispoint;
            Font thisFont = new Font("Times New Roman", 100);
            SolidBrush thisbrush = new SolidBrush(Color.Red);
    
            public frmFlow()
            {
                InitializeComponent();
            }
    
            private void frmFlow_Load(object sender, EventArgs e)
            {
                SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);
                SetStyle(ControlStyles.ResizeRedraw, true); 
                timer1.Start();
            }
    
            SizeF size = new SizeF();
            RectangleF rc = new RectangleF();
            private void timer1_Tick(object sender, EventArgs e)
            {
                FineString = "(-: Smile :-)";
                timer1.Interval = 33; //(int)nudSpeed.Value; ;
                Invalidate();
            }
            protected PointF getPoint()
            {
                thispoint.X -= 5;//(int)nudDistance.Value; 
                if (thispoint.X <= 0 - size.Width)
                {
                    thispoint.X = this.Width;
                }
                thispoint.Y = 180;
                return thispoint;
            }
    
            private void frmFlow_Paint(object sender, PaintEventArgs e)
            {
                size = e.Graphics.MeasureString(FineString, thisFont);
                 e.Graphics.DrawString(FineString, thisFont, thisbrush, getPoint());
            }
    }

    it's very well but how can i speed it up that it will not look like jumping and look nice so i want to know what to speed up the interval of the timer or to decrease the X point in getpoint or something else
    please if you can write a code to do
    thank
    Last edited by tlhintoq; Jan 17 '10, 09:19 PM. Reason: [CODE] ... your code here ... [/CODE] tags added
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    i want to know what to speed up the interval of the timer
    Line 25. Change the .Interval to a smaller number.. Though 33 miliseconds is already fairly quick.

    Am I correct in determining that this takes the string "(-: Smile :-)" and scrolls it from right to left in jumps of 5 pixels?
    that it will not look like jumping
    You could move it in smaller increments than 5 pixels.

    Comment

    • avigreen
      New Member
      • Jan 2010
      • 2

      #3
      thanks

      you are right the string is scolling from right to left
      i need to scroll it very fast for some reasons
      thanks again

      Comment

      Working...