1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

cscの作法 その529

Posted at

概要

cscの作法、調べてみた。
練習問題やってみた。

練習問題

webbrowserを使え。

方針

  • 画像ビューワーを作る。

写真

image.png

サンプルコード

using System;
using System.Windows.Forms;
using System.Drawing;

class form1: Form {
	TextBox bo1;
	WebBrowser wb0;
	form1() {
		Text = "WebBrowser";
		ClientSize = new Size(720, 300);
		bo1 = new TextBox();
		bo1.Location = new Point(10, 10);
		bo1.Text = "data:image/gif;base64,R0lGODlhAQABAIAAAHd3dwAAACH5BAAAAAAALAAAAAABAAEAAAICRAEAOw==";
		bo1.Size = new Size(600, 20);
		Controls.Add(bo1);
		Button btn1 = new Button();
		btn1.Location = new Point(630, 10);
		btn1.Text = "run";
		btn1.Click += btn1_Click;
		Controls.AddRange(new Control[] {
			btn1
		});
		wb0 = new WebBrowser();
		wb0.Location = new Point(10, 40);
		wb0.Width = 480;
		wb0.Height = 240;
		wb0.ScriptErrorsSuppressed = true;
		Controls.AddRange(new Control[] {
			wb0
		});
	}
	void btn1_Click(object sender, System.EventArgs e) {
		wb0.DocumentText = "<HTML><BODY><img src='" + bo1.Text + "' ></BODY></HTML>";
	}
	[STAThread]
	public static void Main() {
		Application.Run(new form1());
	}
}

以上

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?