コード例 #1
0
        private void btnExportAsVideo_Click(object sender, EventArgs e)
        {
            if (tour != null && tour.WaypointsNumber > 2)
            {
                SaveFileDialog sd = new SaveFileDialog();
                sd.AddExtension = true;
                sd.DefaultExt   = "avi";
                sd.Filter       = "AVI文件|*.avi";
                if (System.IO.Directory.Exists(strMediaPath))
                {
                    sd.InitialDirectory = strMediaPath;
                }
                sd.RestoreDirectory = true;
                if (sd.ShowDialog() == DialogResult.OK)
                {
                    String final = sd.FileName;
                    if (sd.FileName.LastIndexOf(".avi") == -1)
                    {
                        final = String.Format("{0}.avi", sd.FileName);
                    }

                    bool b = tour.ExportVideo(final, 25);
                    if (!b)
                    {
                        MessageBox.Show("输出视频失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("当前动画导航为空或者节点数小于2,不支持视频输出!");
            }
        }
コード例 #2
0
 // 输出视频结束
 private void AxRenderControl_RcVideoExportEnd(object sender, _IRenderControlEvents_RcVideoExportEndEvent e)
 {
     if (e.isAborted)
     {
         XtraMessageBox.Show("输出取消!", "提示");
         this._dlg.Close();
         this.UnAdviseEvent();
         return;
     }
     if (this._groupNodeToPlay == null)
     {
         this.time  = e.time;
         this.time /= 1000.0;
         this.time  = System.Math.Round(this.time, 2);
         XtraMessageBox.Show("输出完成,用时" + this.time + "秒。", "提示");
         this._dlg.Close();
         this.UnAdviseEvent();
         return;
     }
     this._dlg.Close();
     this.time += e.time;
     this.time /= 1000.0;
     this._groupNodeToPlay.RemoveAt(0);
     if (this._groupNodeToPlay.Count > 0)
     {
         TreeListNode treeListNode = this._groupNodeToPlay[0] as TreeListNode;
         ICameraTour  cameraTour   = treeListNode.GetValue("tl_Object") as ICameraTour;
         this._vindex++;
         cameraTour.ExportVideo(this._fileName + "_" + this._vindex.ToString() + this._fileType, this._fps);
         this._treelist.SetFocusedNode(treeListNode);
         return;
     }
     if (this._groupNodeToPlay.Count == 0)
     {
         this._treelist.SetFocusedNode(this._lastNodeInGroup);
         this.time = System.Math.Round(this.time, 2);
         XtraMessageBox.Show("输出完成,用时" + this.time + "秒。", "提示");
         this._dlg.Close();
         this.UnAdviseEvent();
     }
 }