using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
webBrowser1.DocumentText =
"<body style=\"font-family:\'メイリオ\'; \">" +
"<font size=\"2\">メイリオ</font><br>" +
"<font size=\"4\" color=\"orangered\">メイリオ</font>" +
"<img src='file:///C:/Users/xxx/source/repos/WindowsFormsApp5/WindowsFormsApp5/bin/Debug/m.png'>";
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
}
}
}
実行結果
参照したURL:
https://www.aspsnippets.com/Articles/Load-and-display-HTML-string-in-WebBrowser-control-in-Windows-Application-using-C-and-VBNet.aspx