예제 #1
0
        private void UpdateWordsList()
        {
            if (Value != null)
            {
                Value.ClearWords();
            }
            bool bFirst = true;

            foreach (string s in richTextBox1.Lines)
            {
                GOFRunningTextItem rti = new GOFRunningTextItem()
                {
                    Text = s, TimeOffset = 0
                };
                if (bFirst)
                {
                    rti.Valid      = true;
                    rti.TimeOffset = 0;
                }
                if (Value != null)
                {
                    Value.AddWord(rti);
                }
                bFirst = false;
            }
        }
예제 #2
0
 private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listBox1.SelectedIndex >= 0)
     {
         GOFRunningTextItem gi = (GOFRunningTextItem)(listBox1.SelectedItem);
         if (gi != null && player.Playing)
         {
             gi.TimeOffset = Convert.ToInt64((DateTime.Now - startTicks).TotalMilliseconds);
             gi.Valid      = true;
         }
     }
 }
예제 #3
0
        private void listBox1_DrawItem(object sender, DrawItemEventArgs e)
        {
            if (e.Index >= 0 && e.Index < listBox1.Items.Count)
            {
                Rectangle rect = e.Bounds;
                rect.Width = rect.Width / 2 - e.Bounds.Height;
                rect.X    += e.Bounds.Height;

                e.Graphics.FillRectangle(SystemBrushes.Window, e.Bounds);
                if (p_sformat == null)
                {
                    p_sformat               = new StringFormat();
                    p_sformat.Alignment     = StringAlignment.Near;
                    p_sformat.LineAlignment = StringAlignment.Center;
                    p_sformat.Trimming      = StringTrimming.EllipsisCharacter;
                }

                GOFRunningTextItem gi = (GOFRunningTextItem)(listBox1.Items[e.Index]);

                if (gi != null)
                {
                    e.Graphics.DrawString(gi.Text, listBox1.Font, SystemBrushes.ControlText, rect, p_sformat);
                    rect.X += rect.Width;
                    if (gi.Valid)
                    {
                        string time = string.Format("{0} ms", (long)(gi.TimeOffset));
                        e.Graphics.DrawString(time, listBox1.Font, Brushes.DarkBlue, rect, p_sformat);
                    }
                    else
                    {
                        e.Graphics.DrawString("??", listBox1.Font, Brushes.Gray, rect);
                    }
                }

                if ((e.State & DrawItemState.Selected) != 0)
                {
                    rect.Width = rect.Height;
                    rect.X     = 0;
                    rect.Inflate(-2, -2);
                    e.Graphics.FillRectangle(Brushes.DarkCyan, rect);
                }
            }
        }