Ejemplo n.º 1
0
        private void DrawWebControlImage(WebHostControl ctrl)
        {
            if (!ctrl.Visible)
            {
                System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch();
                watch.Start();
                Bitmap bmp = ctrl.GetWebControlImage();

                if (bmp == null)
                {
                    return;
                }

                watch.Stop();
                Graphics grphx = Graphics.FromHwnd(Handle);
                grphx.DrawImage(bmp, _webControlRect);
                button1.Text = $"Image ({watch.ElapsedMilliseconds})";
            }
        }
Ejemplo n.º 2
0
        private void LoadWebControl()
        {
            string filePath = @"file:///" + AppDomain.CurrentDomain.BaseDirectory.Replace('\\', '/');

            //_basePage = File.ReadAllText("WebHostControl/BaseHTML.html");
            //_basePage = File.ReadAllText("WebHostControl/Gears.html");
            //_script = File.ReadAllText("WebHostControl/d3.v3.min.js");

            ////show Gantt diagrams chart
            //_basePage = File.ReadAllText("WebHostControl/GanttChart/GanttChart.html");
            ////_basePage = _basePage.Replace(_stylePath, filePath + @"WebHostControl/GanttChart/style.css");
            //_basePage = _basePage.Replace("_sourcesPath", filePath + @"WebHostControl");

            //show Markdown editor
            //_basePage = File.ReadAllText("WebHostControl/SimpleMDE/MarkdownEditor.html");
            //_basePage = _basePage.Replace(_stylePath, filePath + @"WebHostControl/SimpleMDE/simplemde.min.css");
            //_basePage = _basePage.Replace(_d3Script, filePath + @"WebHostControl/SimpleMDE/simplemde.min.js");

            //show Quill editor
            //_basePage = File.ReadAllText("WebHostControl/QuillEditor/QuillEditor.html");
            //_basePage = _basePage.Replace(_stylePath, filePath + @"WebHostControl/QuillEditor/quill.snow.css");
            //_basePage = _basePage.Replace("_d3Script", filePath + @"WebHostControl/QuillEditor/quill.js");
            //_basePage = _basePage.Replace(_d3Script, filePath + @"WebHostControl/QuillEditor/quill.min.js");

            //show Pen editor
            //_basePage = File.ReadAllText("WebHostControl/PenEditor/PenEditor.html");
            //_basePage = _basePage.Replace(_stylePath, filePath + @"WebHostControl/PenEditor/pen.css");
            //_basePage = _basePage.Replace(_d3Script, filePath + @"WebHostControl/PenEditor/pen.js");

            //MediumEditor
            //_basePage = File.ReadAllText("WebHostControl/MediumEditor/MediumEditor.html");
            //_basePage = _basePage.Replace("_sourcesPath", filePath + @"WebHostControl/MediumEditor");

            _webHostCtrl = WebEditorControl.CreateWebEditorControl();
            _webHostCtrl.SetFont("Roboto", "10px");
            //_webHostCtrl = new WebHostControl();
            //_webHostCtrl.Navigate("https://quilljs.com/playground/#quill-playground");

            Controls.Add(_webHostCtrl);
            _webHostCtrl.SizeChanged    += WebHostCtrlSizeChanged;
            _webHostCtrl.VisibleChanged += WebHostCtrlVisibleChanged;
        }