public static void InsertAudio(IHTMLDocument2 m_pDoc2) { InsertAudioCodeForm insertAudio = new InsertAudioCodeForm(); if (insertAudio.ShowDialog() == DialogResult.OK) { if (insertAudio.MediaPath != string.Empty) { //不管如何,只要存在此文件则加入到HTML编辑器中 string path = insertAudio.MediaPath;// FileFullPath;// Path.GetFileName(Path.GetDirectoryName(FileFullPath)) + "/" + Path.GetFileName(FileFullPath); string mwidth = insertAudio.MediaWidth.ToString() + insertAudio.MediaWidUint; string mheight = insertAudio.MediaHeight.ToString() + insertAudio.MediaHeigUint; string mvspace = insertAudio.MediaVspace.ToString(); string mhspace = insertAudio.MediaHspace.ToString(); string mtitle = insertAudio.MediaTitle; string maccesskey = insertAudio.MediaAccessKey; string mtabindex = insertAudio.MediaTab; string mscale = insertAudio.MediaScale; Audio.Align malign = insertAudio.AudioAlign; Audio.Quality mquality = insertAudio.AudioQuality; bool misloopplay = insertAudio.MediaLoop; bool misautopaly = insertAudio.MediaAutoPlay; string mediaID = insertAudio.MediaID; Audio insAudio = new Audio(); string insAudioHtml = insAudio.AudioHtml(path, mwidth, mheight, mvspace, mhspace, mtitle, maccesskey, mtabindex, malign, mquality, misloopplay, misautopaly, mscale, mediaID); AddToSelection(m_pDoc2, insAudioHtml, ""); string s = m_pDoc2.body.outerHTML; } } }
/// <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(); } } }