Exemplo n.º 1
0
        public void IconClicked(HTMLEditorButtonArgs args)
        {
            var colorPicker = new ColorDialog();
            var result      = colorPicker.ShowDialog();

            if (result == DialogResult.OK)
            {
                var color    = colorPicker.Color;
                var hexcolor = ColorTranslator.ToHtml(color);
                args.Document.ExecCommand("ForeColor", false, hexcolor);
            }
        }
        public void IconClicked(HTMLEditorButtonArgs args)
        {
            var x = args.Editor.Location.X + 10;
            var y = args.Editor.Location.Y + 10;

            //var url = Interaction.InputBox("Please enter an image url", "URL", null, x, y);
            //if (!string.IsNullOrEmpty(url))
            //{
            //    args.Document.ExecCommand("InsertImage", false, url);
            //}

            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            //openFileDialog1.InitialDirectory = "c:\\";
            openFileDialog1.Filter           = "Image Files (*.png, *.jpg)|*.png;*.jpg";
            openFileDialog1.FilterIndex      = 2;
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string file = openFileDialog1.FileName;//, file_name = "";
                args.Document.ExecCommand("InsertImage", false, file);
            }

            ////OpenFileDialog openFileDialog1 = new OpenFileDialog();
            //////openFileDialog1.InitialDirectory = "c:\\";
            ////openFileDialog1.Filter = "Image Files (*.png, *.jpg)|*.png;*.jpg";
            ////openFileDialog1.FilterIndex = 2;
            ////openFileDialog1.RestoreDirectory = true;

            ////if (openFileDialog1.ShowDialog() == DialogResult.OK)
            ////{
            ////    string file = openFileDialog1.FileName, file_name = "";
            ////    string[] a = file.Split('\\');
            ////    file_name = "/images/[host]/" + a[a.Length - 1];

            ////    string s64 = "";
            ////    using (Image image = Image.FromFile(file))
            ////    {
            ////        using (MemoryStream ms = new MemoryStream())
            ////        {
            ////            image.Save(ms, image.RawFormat);
            ////            byte[] imageBytes = ms.ToArray();
            ////            s64 = "data:image/png;base64," + Convert.ToBase64String(imageBytes);
            ////            //s64 = Convert.ToBase64String(imageBytes);
            ////        }
            ////    }

            ////    args.Document.ExecCommand("InsertImage", false, s64);
            ////}
        } //end function
        public void IconClicked(HTMLEditorButtonArgs args)
        {
            var x = args.Editor.Location.X + 10;
            var y = args.Editor.Location.Y + 10;

            string urc = Clipboard.GetText(TextDataFormat.Text);

            var url = Interaction.InputBox("Please enter an image url", "URL", urc, x, y);

            if (!string.IsNullOrEmpty(url))
            {
                string content = Crawler(url);
            }
        } //end function
Exemplo n.º 4
0
        private ToolStripItem CreateButton(IHTMLEditorButton toolbarItem)
        {
            var toolStripButton = new ToolStripButton();

            toolStripButton.DisplayStyle          = ToolStripItemDisplayStyle.Image;
            toolStripButton.Image                 = toolbarItem.IconImage;
            toolStripButton.ImageScaling          = ToolStripItemImageScaling.None;
            toolStripButton.ImageTransparentColor = System.Drawing.Color.Magenta;
            toolStripButton.Name = toolbarItem.IconName;
            toolStripButton.Size = new System.Drawing.Size(25, 24);
            toolStripButton.Text = toolbarItem.IconTooltip;

            var args = new HTMLEditorButtonArgs();

            args.Document = _doc;
            args.Editor   = this;

            IHTMLEditorButton button = toolbarItem;

            toolStripButton.Click += (sender, o) => button.IconClicked(args);

            return(toolStripButton);
        }
 public void IconClicked(HTMLEditorButtonArgs args)
 {
     args.Document.ExecCommand(CommandIdentifier, false, null);
 }
 public void IconClicked(HTMLEditorButtonArgs args)
 {
     args.Document.ExecCommand("InsertUnorderedList", false, null);
 }
 public void IconClicked(HTMLEditorButtonArgs args)
 {
     args.Document.ExecCommand("Italic", false, null);
 }
Exemplo n.º 8
0
 public void IconClicked(HTMLEditorButtonArgs args)
 {
     args.Document.ExecCommand("CreateLink", true, null);
 }