Exemple #1
0
        public static void InsertVideo(IHTMLDocument2 m_pDoc2)
        {
            InsertVideoCodeForm inserVideo = new InsertVideoCodeForm();

            if (inserVideo.ShowDialog() == DialogResult.OK)
            {
                if (inserVideo.MediaPath != string.Empty)
                {
                    //不管如何,只要存在此文件则加入到HTML编辑器中
                    string        path         = inserVideo.MediaPath;// FileFullPath;// Path.GetFileName(Path.GetDirectoryName(FileFullPath)) + "/" + Path.GetFileName(FileFullPath);
                    string        mwidth       = inserVideo.MediaWidth.ToString() + inserVideo.MediaWidUint;
                    string        mheight      = inserVideo.MediaHeight.ToString() + inserVideo.MediaHeigUint;
                    string        mvspace      = inserVideo.MediaVspace.ToString();
                    string        mhspace      = inserVideo.MediaHspace.ToString();
                    string        mtitle       = inserVideo.MediaTitle;
                    string        maccesskey   = inserVideo.MediaAccessKey;
                    string        mtabindex    = inserVideo.MediaTab;
                    string        mscale       = inserVideo.MediaScale;
                    Video.Align   malign       = inserVideo.MediaAlign;
                    Video.Quality mquality     = inserVideo.MediaQuality;
                    bool          misloopplay  = inserVideo.MediaLoop;
                    bool          misautopaly  = inserVideo.MediaAutoPlay;
                    string        mediaID      = inserVideo.MediaID;
                    Video         insmedia     = new Video();
                    string        insMediahtml = insmedia.MediaHtml(path, mwidth, mheight, mvspace, mhspace, mtitle, maccesskey, mtabindex, malign, mquality, misloopplay, misautopaly, mscale, mediaID);
                    AddToSelection(m_pDoc2, insMediahtml, "");
                    //m_pDoc2.body.outerHTML
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// 资源的高级设置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ResourceHighSetting_Click(object sender, EventArgs e)
        {
            if (resourceFilesListView.SelectedItems.Count != 1)
            {
                return;                                                 //不支持多选
            }
            MyListItem myitem = resourceFilesListView.SelectedItems[0] as MyListItem;

            if (myitem is MyListFileItem)
            {
                BaseForm        form         = new BaseForm();
                XhtmlTagElement xhtmlElement = null;// new XhtmlTagElement();
                XhtmlSection    _section     = new XhtmlSection();
                string          strHref      = "[url: " + ((MyListFileItem)myitem).Element.Id + "]";
                switch (((MyListFileItem)myitem).ItemMediaType)
                {
                case MediaFileType.None:
                    break;

                case MediaFileType.Pic:
                    #region 图片
                {
                    xhtmlElement = _section.CreateXhtmlImg();
                    ((XhtmlTags.Img)xhtmlElement).Src = strHref;
                    form = new InsertPicCodeForm(xhtmlElement, ((MyListFileItem)myitem).Element.AbsoluteFilePath);
                    break;
                }

                    #endregion
                case MediaFileType.Flash:
                    #region Flash
                {
                    xhtmlElement = _section.CreateXhtmlFlash();

                    CssSection style = new CssSection();
                    ((XhtmlTags.Flash)xhtmlElement).Builder(style, "", strHref, Xhtml.Align.left, "", -1, -1, "", "", "");
                    form = new InsertFlashCodeForm(xhtmlElement, ((MyListFileItem)myitem).Element.AbsoluteFilePath);

                    break;
                }

                    #endregion
                case MediaFileType.Audio:
                    #region Audio
                {
                    xhtmlElement = _section.CreateXhtmlObject();
                    //((XhtmlTags.Object)xhtmlElement).Src = strHref;
                    form = new InsertAudioCodeForm(xhtmlElement, ((MyListFileItem)myitem).Element.AbsoluteFilePath);
                    break;
                }

                    #endregion
                case MediaFileType.Video:
                    #region Video
                {
                    xhtmlElement = _section.CreateXhtmlObject();
                    //((XhtmlTags.Object)xhtmlElement).Src = strHref;
                    form = new InsertVideoCodeForm(xhtmlElement, ((MyListFileItem)myitem).Element.AbsoluteFilePath);
                    break;
                }

                    #endregion
                default:
                    Debug.Fail("未知的type:" + ((MyListFileItem)myitem).ItemMediaType.ToString());
                    break;
                }
                if (form.ShowDialog() == DialogResult.OK)
                {
                    ((MyListFileItem)myitem).XmlAttribute = (XmlElement)xhtmlElement.ToXmlNode();
                }
            }
        }