Exemplo n.º 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, "");
             *  }
             * }*/
        }
Exemplo n.º 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;
             *  }
             * }*/
        }
Exemplo n.º 3
0
        public static void InsertDateTime(IHTMLDocument2 m_pDoc2)
        {
            InsertDatetimeForm insertDateTime = new InsertDatetimeForm();

            if (insertDateTime.ShowDialog() == DialogResult.OK)
            {
                InsertElementHelper.AddToSelection(m_pDoc2, insertDateTime.InsertDateTimeHTML, "");
            }
        }
Exemplo n.º 4
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, "");
        }
Exemplo n.º 5
0
        void ToolStripComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            IHTMLDocument2    _idoc2 = _ownerHtmlDesigner.DesignWebBrowser.idoc2;
            ToolStripComboBox item   = sender as ToolStripComboBox;

            switch (item.Name)
            {
            case "fontToolStripComboBox":
            {
                _idoc2.execCommand("FontName", true, item.Text);
                break;
            }

            case "sizeToolStripComboBox":
            {
                _idoc2.execCommand("FontSize", true, item.Text);
                break;
            }

            case "paraToolStripComboBox":
            {
                string beginStr = "";
                string endStr   = "";
                switch (item.ComboBox.SelectedIndex)
                {
                case 0: { beginStr = "<P>"; endStr = "</P>"; break; }

                case 1: { beginStr = "<H1>"; endStr = "</H1>"; break; }

                case 2: { beginStr = "<H2>"; endStr = "</H2>"; break; }

                case 3: { beginStr = "<H3>"; endStr = "</H3>"; break; }

                case 4: { beginStr = "<H4>"; endStr = "</H4>"; break; }

                case 5: { beginStr = "<H5>"; endStr = "</H5>"; break; }

                case 6: { beginStr = "<H6>"; endStr = "</H6>"; break; }
                }
                InsertElementHelper.AddToSelection(_idoc2, beginStr, endStr);
                break;
            }

            default:
                break;
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// 插入HTML元素,窗口切换
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void HTMLToolStrip_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            idoc2 = _ownerHtmlDesigner.DesignWebBrowser.idoc2;
            ToolStripButton thisBtn = e.ClickedItem as ToolStripButton;

            if (thisBtn == null)
            {
                return;
            }
            switch (thisBtn.Name)
            {
            case "leftToolStripButton":
            {
                idoc2.execCommand("JustifyLeft", true, true);
                break;
            }

            case "rightToolStripButton":
            {
                idoc2.execCommand("JustifyRight", true, true);
                break;
            }

            case "allToolStripButton":
            {
                idoc2.execCommand("JustifyCenter", true, true);
                break;
            }

            case "boldToolStripButton":
            {
                idoc2.execCommand("bold", true, true);
                break;
            }

            case "inToolStripButton":
            {
                idoc2.execCommand("Indent", true, true);
                break;
            }

            case "outToolStripButton":
            {
                idoc2.execCommand("Outdent", true, true);
                break;
            }

            case "numToolStripButton":
            {
                idoc2.execCommand("InsertOrderedList", true, true);
                break;
            }

            case "listToolStripButton":
            {
                idoc2.execCommand("InsertUnorderedList", true, true);
                break;
            }

            case "italicToolStripButton":
            {
                idoc2.execCommand("italic", true, true);
                break;
            }

            case "underlineToolStripButton":
            {
                idoc2.execCommand("underline", true, true);
                break;
            }

            case "DesignToolStripButton":
            {
                if (OwnerHtmlDesigner.splitCon.Panel1Collapsed)
                {
                    OwnerHtmlDesigner.splitCon.Panel2Collapsed = true;
                    OwnerHtmlDesigner.DesignWebBrowser.Document.Body.InnerHtml = OwnerHtmlDesigner.CodeRichText.Text;
                    designToolStripButton.Checked = true;
                    codeToolStripButton.Checked   = false;
                }
                break;
            }

            case "CodeToolStripButton":
            {
                if (OwnerHtmlDesigner.splitCon.Panel2Collapsed)
                {
                    OwnerHtmlDesigner.splitCon.Panel1Collapsed = true;
                    OwnerHtmlDesigner.CodeRichText.Text        = OwnerHtmlDesigner.DesignWebBrowser.Document.Body.InnerHtml;
                    codeToolStripButton.Checked   = true;
                    designToolStripButton.Checked = false;
                }
                break;
            }

            case "signToolStripButton":
            {
                InsertElementHelper.AddToSelection(idoc2, currentSign, "");
                break;
            }

            case "propertyToolStripTextBox":
            {
                //string pageId = _htmlDesigner.PageId;
                //PagePropertyForm pageTextPropertyForm = new PagePropertyForm(pageId);
                //pageTextPropertyForm.ShowDialog(Service.Workbench.MainForm);
                break;
            }

            case "tableToolStripButton":
            {
                InsertElementHelper.Inserttable(idoc2);
                break;
            }

            case "linkToolStripButton":
            {
                InsertElementHelper.Insertlink(_ownerHtmlDesigner);
                break;
            }

            case "imageToolStripButton":
            {
                InsertElementHelper.InsertImage(_ownerHtmlDesigner);
                break;
            }

            case "flashToolStripButton":
            {
                InsertElementHelper.InsertFlash(_ownerHtmlDesigner);
                break;
            }

            case "mediaToolStripButton":
            {
                InsertElementHelper.InsertVideo(_ownerHtmlDesigner);
                break;
            }

            case "emailToolStripButton":
            {
                InsertElementHelper.InsertEmail(idoc2);
                break;
            }

            case "dateToolStripButton":
            {
                InsertElementHelper.InsertDateTime(idoc2);
                break;
            }

            case "brToolStripButton":
            {
                InsertElementHelper.AddToSelection(idoc2, "<BR />", "");
                break;
            }

            case "hrToolStripButton":
            {
                InsertElementHelper.AddToSelection(idoc2, "<HR />", "");
                break;
            }

            case "audioToolStripButton":
            {
                InsertElementHelper.InsertAudio(_ownerHtmlDesigner);
                break;
            }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// 插入符号
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void signToolStripDropDownButton_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            IHTMLDocument2    _idoc2       = _ownerHtmlDesigner.DesignWebBrowser.idoc2;
            ToolStripMenuItem toolMenuItem = sender as ToolStripMenuItem;

            switch (e.ClickedItem.Name)
            {
            case "br":
            {
                InsertElementHelper.AddToSelection(_idoc2, "<br />", "");
                currentSign = "<br />";
                break;
            }

            case "nbsp":
            {
                InsertElementHelper.AddToSelection(_idoc2, "&nbsp;", "");
                currentSign = "&nbsp;";
                break;
            }

            case "L_quotation":
            {
                InsertElementHelper.AddToSelection(_idoc2, "&#8220;", "");
                currentSign = "&#8220;";
                break;
            }

            case "R_quotation":
            {
                InsertElementHelper.AddToSelection(_idoc2, "&#8221;", "");
                currentSign = "&#8221;";
                break;
            }

            case "desh":
            {
                InsertElementHelper.AddToSelection(_idoc2, "&#8212;", "");
                currentSign = "&#8212;";
                break;
            }

            case "pound":
            {
                InsertElementHelper.AddToSelection(_idoc2, "&pound;", "");
                currentSign = "&pound;";
                break;
            }

            case "Eurocurrency":
            {
                InsertElementHelper.AddToSelection(_idoc2, "&#8364;", "");
                currentSign = "&#8364;";
                break;
            }

            case "yen":
            {
                InsertElementHelper.AddToSelection(_idoc2, "&yen;", "");
                currentSign = "&yen;";
                break;
            }

            case "copyright":
            {
                InsertElementHelper.AddToSelection(_idoc2, "&copy;", "");
                currentSign = "&copy;";
                break;
            }

            case "reg_trad_mark":
            {
                InsertElementHelper.AddToSelection(_idoc2, "&reg;", "");
                currentSign = "&reg;";
                break;
            }

            case "brand":
            {
                InsertElementHelper.AddToSelection(_idoc2, "&#8482;", "");
                currentSign = "&#8482;";
                break;
            }

            case "osign":
            {
                InsertOtherForm sign = new InsertOtherForm();
                if (sign.ShowDialog() == DialogResult.OK)
                {
                    InsertElementHelper.AddToSelection(_idoc2, sign.InsertSign, "");
                    currentSign = sign.InsertSign;
                }
                break;
            }
            }

            signToolStripButton.Text         = HttpUtility.HtmlDecode(currentSign);
            signToolStripDropDownButton.Text = "";
        }