LAN経由で現場のディスプレイに資料を表示させておくアイデアの検証用。
何かしらのスクリプトで資料のファイルを自動で開く方法も考えたけど、資料を準備する側が画像に変換する手間をかけれるならプログラムが簡単で済む。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
using System; using System.Drawing; using System.Windows.Forms; namespace WindowsFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); var timer = new Timer(); timer.Tick += (s, e) => { DisplayImage(); }; timer.Interval = 1000 * 60 * 15; // 15分 timer.Start(); this.Resize += (s, e) => { var w = this.Width - 50; var h = this.Height - 70; pictureBox1.Left = 10; pictureBox1.Top = 10; pictureBox1.Width = w / 2; pictureBox1.Height = h / 2; pictureBox2.Left = w / 2 + 20; pictureBox2.Top = 10; pictureBox2.Width = w / 2; pictureBox2.Height = h / 2; pictureBox3.Left = 10; pictureBox3.Top = h / 2 + 20; pictureBox3.Width = w / 2; pictureBox3.Height = h / 2; pictureBox4.Left = w / 2 + 20; pictureBox4.Top = h / 2 + 20; pictureBox4.Width = w / 2; pictureBox4.Height = h / 2; }; pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; pictureBox2.SizeMode = PictureBoxSizeMode.Zoom; pictureBox3.SizeMode = PictureBoxSizeMode.Zoom; pictureBox4.SizeMode = PictureBoxSizeMode.Zoom; pictureBox1.BorderStyle = BorderStyle.FixedSingle; pictureBox2.BorderStyle = BorderStyle.FixedSingle; pictureBox3.BorderStyle = BorderStyle.FixedSingle; pictureBox4.BorderStyle = BorderStyle.FixedSingle; pictureBox1.BackColor = Color.White; pictureBox2.BackColor = Color.White; pictureBox3.BackColor = Color.White; pictureBox4.BackColor = Color.White; this.WindowState = FormWindowState.Maximized; DisplayImage(); } private void DisplayImage() { string dir = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\image\"; pictureBox1.ImageLocation = dir + "1.jpg"; pictureBox2.ImageLocation = dir + "2.jpg"; pictureBox3.ImageLocation = dir + "3.jpg"; pictureBox4.ImageLocation = dir + "4.jpg"; Text = DateTime.Now.ToString("工場掲示板 MM月dd日HH時mm分") + " 更新"; } } } |