/// <summary>
 /// 视频绘图
 /// </summary>
 /// <param name="e"></param>
 protected virtual void OnVideoPaint(VideoPaintEventArgs e)
 {
     if (this.VideoPaint != null) this.VideoPaint(this, e);
 }
        protected override void OnVideoPaint(VideoPaintEventArgs e)
        {
            Graphics G = e.Graphics;

            #region 绘制虚拟按钮
            VirtualButton.VirtualPaint(this, G);
            #endregion

            #region 绘制选择框
            if (this.isSelected)
            {
                Rectangle rectSelected = new Rectangle(0, 0, this.Width - 3, this.Height - 2);
                VirtualBase.DrawRectangle(G, Pens.Lime, rectSelected);
            }
            #endregion

            #region 绘制报警框
            if (this.group == null && this.alarmCount != 0) this.alarmCount = 0;
            if (this.group != null && this.group.AlarmCount > 0 && this.group.AlarmCount > this.alarmCount)
            {
                if (swAlarm.ElapsedMilliseconds < 500)
                {
                    alarmIndex %= this.group.AlarmCount;
                    AlarmInfo alarm = this.group[alarmIndex];
                    float w = (float)this.Width / (float)this.VideoWidth;
                    float h = (float)this.Height / (float)this.VideoHeight;
                    for (int i = 0; i < alarm.AlarmRegion.Length; i++)
                    {
                        RectangleF rectAlarm = new RectangleF(
                            alarm.AlarmRegion[i].X * w,
                            alarm.AlarmRegion[i].Y * h,
                            alarm.AlarmRegion[i].Width * w,
                            alarm.AlarmRegion[i].Height * h);
                        Color colorAlarm = Color.FromArgb(
                            ((AlarmRegionEnum)alarm.AlarmRegionType[i] & AlarmRegionEnum.Fire) == AlarmRegionEnum.Fire ? 255 : 0,
                            ((AlarmRegionEnum)alarm.AlarmRegionType[i] & AlarmRegionEnum.Smoke) == AlarmRegionEnum.Smoke ? 255 : 0,
                            ((AlarmRegionEnum)alarm.AlarmRegionType[i] & AlarmRegionEnum.Motion) == AlarmRegionEnum.Motion ? 255 : 0);

                        using (Pen pen = new Pen(colorAlarm))
                        {
                            VirtualBase.DrawRectangle(G, pen, Rectangle.Round(rectAlarm));
                        }

                    }
                    Pen penAlarm = new Pen(Color.Red, 3f);
                    VirtualBase.DrawRectangle(G, penAlarm, new Rectangle(2, 2, this.Width - 7, this.Height - 6));
                    penAlarm.Dispose();
                }
                else if (swAlarm.ElapsedMilliseconds > 1000)
                {
                    alarmIndex++;
                    swAlarm.Reset();
                    swAlarm.Start();
                }
            }
            else if (alarmIndex != 0) alarmIndex = 0;
            #endregion

            base.OnVideoPaint(e);
        }