Exemplo n.º 1
0
 void im_Tick(object sender, EventArgs e)
 {
     try
     {
         index++;
         index = index % (Int32.MaxValue / 2);
         Refresh();
     }
     catch (Exception fs)
     {
         PrinftHelper.LogException(fs);
     }
 }
Exemplo n.º 2
0
 private void lst_DrawItem(object sender, DrawItemEventArgs e)
 {
     try
     {
         n++;
         e.DrawBackground();
         e.DrawFocusRectangle();
         string tex   = (this.Items[e.Index]).ToString();
         SizeF  sizeF = e.Graphics.MeasureString(tex, e.Font);
         if (sizeF.Width < e.Bounds.Width)
         {
             e.Graphics.DrawString(tex, e.Font, new SolidBrush(e.ForeColor), e.Bounds);
         }
         else
         {
             BigCount++;
             int    start         = index % tex.Length;
             string ForeString    = tex.Substring(0, start);
             string Beforestring  = tex.Substring(start);
             string ChangedString = Beforestring + ForeString;
             start = 0;
             while (start < ChangedString.Length && e.Graphics.MeasureString(ChangedString.Substring(0, start), e.Font).Width < e.Bounds.Width)
             {
                 start++;
             }
             string RealString = ChangedString.Substring(0, start);
             e.Graphics.DrawString(RealString, e.Font, new SolidBrush(e.ForeColor), e.Bounds);
         }
         if (n >= this.Items.Count)
         {
             IsAutoScrollColomn = BigCount > 0;
             n        = 0;
             BigCount = 0;
         }
     }
     catch (Exception fgg)
     {
         PrinftHelper.LogException(fgg);
         try
         {
             string tex = (this.Items[e.Index]).ToString();
             e.Graphics.DrawString(tex, e.Font, new SolidBrush(e.ForeColor), e.Bounds);
         }
         catch (Exception gd)
         {
             PrinftHelper.LogException(gd);
             e.Graphics.DrawString(this.Name, e.Font, new SolidBrush(e.ForeColor), e.Bounds);
         }
     }
 }