Exemple #1
0
        public static void InsertVideo(HTMLDesignerContrl htmlDesigner)
        {
            string htmlCode = htmlDesigner.OpenMediaDialog();

            InsertElementHelper.AddToSelection(htmlDesigner.DesignWebBrowser.idoc2, htmlCode, "");

            /*InsertVideoCodeForm inserVideo = new InsertVideoCodeForm(htmlDesigner);
             * 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;
             *      Align malign = inserVideo.MediaAlign;
             *      Quality mquality = inserVideo.MediaQuality;
             *      bool misloopplay = inserVideo.MediaLoop;
             *      bool misautopaly = inserVideo.MediaAutoPlay;
             *      string mediaID = inserVideo.MediaID;
             *      Video insmedia = new Video();
             *      string insMediahtml = insmedia.MediaHtml(htmlDesigner.InsertUseMode,path, mwidth, mheight, mvspace, mhspace, mtitle, maccesskey, mtabindex, malign, mquality, misloopplay, misautopaly, mscale, mediaID);
             *      AddToSelection(htmlDesigner.DesignWebBrowser.idoc2, insMediahtml, "");
             *  }
             * }*/
        }
Exemple #2
0
        public static void InsertFlash(HTMLDesignerContrl htmlDesigner)
        {
            string htmlCode = htmlDesigner.OpenFlashDialog();

            InsertElementHelper.AddToSelection(htmlDesigner.DesignWebBrowser.idoc2, htmlCode, "");

            /*InsertFlashCodeForm insertflash = new InsertFlashCodeForm(htmlDesigner);
             * 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;
             *      Align falign = insertflash.FlashAlign;
             *      Quality fquality = insertflash.FlashQuality;
             *      bool fisloopplay = insertflash.MediaLoop;
             *      bool fisautopaly = insertflash.MediaAutoPlay;
             *      string mediaID = insertflash.MediaID;
             *      Flash insflash = new Flash();
             *      string insflashhtml = insflash.FlashHtml(htmlDesigner.InsertUseMode,path, fwidth, fheight, fvspace, fhspace, ftitle, faccesskey, ftabindex, falign, fquality, fisloopplay, fisautopaly, fscale, mediaID);
             *      AddToSelection(htmlDesigner.DesignWebBrowser.idoc2, insflashhtml, "");
             *      // m_pDoc2.body.outerHTML;
             *  }
             * }*/
        }
Exemple #3
0
        public static void InsertImage(HTMLDesignerContrl htmlDesigner)
        {
            string htmlCode = htmlDesigner.OpenPicDialog();

            /* InsertPicCodeForm insertpic = new InsertPicCodeForm();
             * insertpic.HtmlDesigner = htmlDesigner;
             * if (insertpic.ShowDialog() == DialogResult.OK)
             * {
             *   InsertElementHelper.AddToSelection(htmlDesigner.DesignWebBrowser.idoc2, insertpic.InsertImageHTML, "");
             * }*/
            InsertElementHelper.AddToSelection(htmlDesigner.DesignWebBrowser.idoc2, htmlCode, "");
        }
Exemple #4
0
        public InsertPicCodeForm(XhtmlTagElement imgEle, string path)
        {
            InitializeComponent();
            _htmldesigner = htmlDesigner;
            //_insertUserMode = htmlDesigner.InsertUseMode;

            AbsoluteFilePath = path;

            _imgEle                 = (XhtmlTags.Img)imgEle;
            picIDTextBox.Text       = _imgEle.GetAttribute("src");
            picPathTextBox.Text     = path;
            replaceWordTextBox.Text = _imgEle.GetAttribute("title");
            if (!string.IsNullOrEmpty(_imgEle.GetAttribute("width")))
            {
                PicWidthNumericUpDown.Value = Convert.ToInt32(_imgEle.GetAttribute("width"));
            }
            if (!string.IsNullOrEmpty(_imgEle.GetAttribute("height")))
            {
                PicHeightNumericUpDown.Value = Convert.ToInt32(_imgEle.GetAttribute("height"));
            }
            this.ImeMode = ImeMode.On;

            if (!string.IsNullOrEmpty(path))
            {
                Size sizeofpic = GetSizeOfPic(path);
                PicWidthNumericUpDown.Value  = sizeofpic.Width;
                PicHeightNumericUpDown.Value = sizeofpic.Height;
                ratio = Convert.ToDecimal(sizeofpic.Width) / Convert.ToDecimal(sizeofpic.Height);
                widthUnitComBox.SelectedIndex = heightUnitComboBox.SelectedIndex = 0;

                //this.widthCheckBox.Checked = true;
                //this.heightCheckBox.Checked = true;
                //this.limitCheckBox.Enabled = true;
                //this.limitCheckBox.Checked = true;
            }
        }
Exemple #5
0
        public static void Insertlink(HTMLDesignerContrl htmlDesigner)
        {
            htmlDesigner.InsertLink();
            return;

            string innerText = "";

            if (htmlDesigner.DesignWebBrowser.idoc2.selection.type == "Text")//如果选中的是文本
            {
                IHTMLTxtRange searchRange = (IHTMLTxtRange)htmlDesigner.DesignWebBrowser.idoc2.selection.createRange();
                innerText = searchRange.htmlText;//获取文本的html代码
            }


            //if (m_pDoc2.selection.type == "Control")//如果选中的控件
            {
                /* IHTMLTxtRange searchRange = (IHTMLTxtRange)m_pDoc2.selection.createRange();
                 * innerText = searchRange.htmlText;//获取文本的html代码*/
            }

            //frmInsertLinkCode insertLink = new frmInsertLinkCode();
            //HTMLAnchorElement linkEle = htmlDesigner.CurrentElement as HTMLAnchorElement;
            //if (linkEle != null)
            //{//给弹出的控件赋值
            //    string hrefStr = linkEle.href.Replace("about:blank", "").Replace("about:", "");
            //    if (hrefStr.IndexOf("#") > 0)
            //    {
            //        insertLink.linkUrl = hrefStr.Substring(0, hrefStr.IndexOf("#"));
            //        insertLink.BookMark = hrefStr.Substring(1 + hrefStr.IndexOf("#"));
            //        insertLink.linkTarget = linkEle.target;
            //        insertLink.LinkTip = linkEle.title;
            //        insertLink.AccessKey = linkEle.accessKey;
            //    }
            //    else
            //    {
            //        insertLink.linkUrl = hrefStr;
            //    }
            //}
            //if (insertLink.ShowDialog() == DialogResult.OK)
            //{
            //    //从弹出的控件中取值
            //    if ((m_pDoc2.selection.type == "None") && (htmlDesigner.LinkBe != null))//如果没有选中文本,则对当前链接进行更改,否则插入新链接
            //    {
            //        htmlDesigner.LinkBe.Element.href = insertLink.linkUrl;
            //        htmlDesigner.LinkBe.Element.target = insertLink.linkTarget;
            //        htmlDesigner.LinkBe.Element.accessKey = insertLink.AccessKey;
            //         htmlDesigner.LinkBe.Element.tabIndex = insertLink.BookMark;
            //    }
            //    else
            //    {
            //        m_pDoc2.selection.clear();
            //        string linkURL = insertLink.linkUrl;
            //        string linkTarget = insertLink.linkTarget;
            //        string linkAccesskey = insertLink.AccessKey;
            //        string linkTip = insertLink.LinkTip;
            //        string linkBookMark = insertLink.BookMark;
            //        LINK link = new LINK();
            //        string insertlinkhtml = link.LinkHtml(innerText, linkURL, linkTarget, linkTip, linkAccesskey, linkBookMark);
            //        AddToSelection(m_pDoc2, insertlinkhtml, "");

            //    }
            //}
        }