Re[3]: бегущяя строка потребляет 100% CPU!!!(
От: Vovstehn  
Дата: 19.12.07 18:33
Оценка:
Здравствуйте, Аноним, Вы писали:

А>сделал так


А>
А>public class RunLabel : Control
А>            {
А>                private string Text;
А>                public string LblText
А>                {
А>                    get { return this.Text; }
А>                    set { this.Text = value; }
А>                }
А>                public RunLabel()
А>                {
А>                    SetStyle(ControlStyles.AllPaintingInWmPaint, true);
А>                    SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
А>                }
А>                public int LblLeft
А>                {
А>                    get { return this.Left; }
А>                    set 
А>                    { 
А>                        this.Left = value;
А>                        this.Refresh();
А>                    }
А>                }

А>                protected override void OnPaint(PaintEventArgs e)
А>                {
А>                   e.Graphics.DrawString(this.Text, Font, new SolidBrush(ForeColor), this.Location.X, this.Location.Y);
А>                    base.OnPaint(e);
А>                }
А>            }
А>

А>когда вызываю LblLeft доходит до Refresh, только OnPaint не вызывается, подскажите, в чем дело (((

Может лучше вот так:
base.OnPaint(e);
e.Graphics.DrawString(this.Text, Font, new SolidBrush(ForeColor), this.Location.X, this.Location.Y);

 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.