private void Redraw()
 {
     Graphics g = Graphics.FromHdc(hMemDc);
     g.Clear(Color.Transparent);
     g.Dispose();
     barrageManager.DrawBarrages(hMemDc);
     if (subtitleManager.Running)
         subtitleManager.DrawSubtitles(hMemDc);
     if (noticeSubtitle != null)
     {
         if (noticeSubtitle.EndTime < stopwatch.ElapsedMilliseconds)
         {
             noticeSubtitle.Dispose();
             noticeSubtitle = null;
         }
         else
             noticeSubtitle.Draw(hMemDc);
     }
     UpdateWindow();
 }
        private void ResetCurrent()
        {
            if (Current != null)
                Current.Dispose();
            if (Alternative != null)
                Alternative.Dispose();
            string content = currentSubtitle.Value.Content;
            if (String.IsNullOrWhiteSpace(content))
            {
                Current = null;
                Alternative = null;
            }
            else
            {
                string[] strs = content.Split(separator, 2, StringSplitOptions.RemoveEmptyEntries);

                if (strs.Length == 2 && !String.IsNullOrWhiteSpace(strs[0]) && !String.IsNullOrWhiteSpace(strs[1]))
                {
                    Alternative = new Subtitle(strs[1].Trim(),
                        parentManager.Font, parentManager.FillColor,
                        parentManager.BorderColor, parentManager.BorderWidth,
                        currentSubtitle.Value.StartTime, currentSubtitle.Value.EndTime);
                    Size size = Alternative.Size;
                    Rectangle rect = parentManager.Rect;
                    Alternative.Location = new Point(rect.Right - size.Width, rect.Bottom - size.Height);
                    Current = new Subtitle(strs[0].Trim(),
                        parentManager.Font, parentManager.FillColor,
                        parentManager.BorderColor, parentManager.BorderWidth,
                        currentSubtitle.Value.StartTime, currentSubtitle.Value.EndTime);
                    size = Current.Size;
                    Current.Location = new Point(rect.Left, rect.Bottom - size.Height - Alternative.Height);
                }
                else
                {
                    Alternative = null;
                    Current = new Subtitle(strs[0].Trim(),
                           parentManager.Font, parentManager.FillColor,
                           parentManager.BorderColor, parentManager.BorderWidth,
                           currentSubtitle.Value.StartTime, currentSubtitle.Value.EndTime);
                    Size size = Current.Size;
                    Rectangle rect = parentManager.Rect;
                    Current.Location = new Point((rect.Left + rect.Right - size.Width) / 2, rect.Bottom - size.Height);
                }
            }
        }
 public void ShowNotice(string notice, int time = 1000)
 {
     if (noticeSubtitle != null)
     {
         noticeSubtitle.Dispose();
         noticeSubtitle = null;
     }
     Font font = new System.Drawing.Font("微软雅黑", 30, FontStyle.Bold, GraphicsUnit.Pixel);
     noticeSubtitle = new Subtitle(notice, font, Color.Yellow, Color.Black, 3.0f,
         stopwatch.ElapsedMilliseconds, stopwatch.ElapsedMilliseconds + time);
     noticeSubtitle.Location = new Point(10, Height - noticeSubtitle.Height - 10);
 }