예제 #1
0
        public static void InsertFlash(IHTMLDocument2 m_pDoc2)
        {
            InsertFlashCodeForm insertflash = new InsertFlashCodeForm();

            if (insertflash.ShowDialog() == DialogResult.OK)
            {
                if (insertflash.MediaPath != string.Empty)
                {
                    //不管如何,只要存在此文件则加入到HTML编辑器中
                    string             path       = insertflash.MediaPath;
                    string             fwidth     = insertflash.MediaWidth.ToString() + insertflash.MediaWidUint;
                    string             fheight    = insertflash.MediaHeight.ToString() + insertflash.MediaHeigUint;
                    string             fvspace    = insertflash.MediaVspace.ToString();
                    string             fhspace    = insertflash.MediaHspace.ToString();
                    string             ftitle     = insertflash.MediaTitle;
                    string             faccesskey = insertflash.MediaAccessKey;
                    string             ftabindex  = insertflash.MediaTab;
                    string             fscale     = insertflash.MediaScale;
                    Flash.FlashAlign   falign     = insertflash.FlashAlign;
                    Flash.FlashQuality fquality   = insertflash.FlashQuality;
                    bool   fisloopplay            = insertflash.MediaLoop;
                    bool   fisautopaly            = insertflash.MediaAutoPlay;
                    string mediaID      = insertflash.MediaID;
                    Flash  insflash     = new Flash();
                    string insflashhtml = insflash.FlashHtml(path, fwidth, fheight, fvspace, fhspace, ftitle, faccesskey, ftabindex, falign, fquality, fisloopplay, fisautopaly, fscale, mediaID);
                    AddToSelection(m_pDoc2, insflashhtml, "");
                    // m_pDoc2.body.outerHTML;
                }
            }
        }
예제 #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();
                }
            }
        }