diff --git a/TIASshot/Form1.cs b/TIASshot/Form1.cs index e42a0d2..67012b2 100644 --- a/TIASshot/Form1.cs +++ b/TIASshot/Form1.cs @@ -21,6 +21,9 @@ public static string APP_NAME = "TIAS Shot"; private LightSource _light = new LightSource(); private bool _isLightOn = true; + private PreviewMonitor _previewMonitor; + private Bitmap _lastBmpShow = null; + /// /// コンストラクタ @@ -84,6 +87,9 @@ Debug.WriteLine("光源の接続に失敗しました"); btnLightSW.Enabled = false; } + + _previewMonitor = new PreviewMonitor(); + _previewMonitor.Show(); } /// @@ -135,6 +141,16 @@ // Invoke((MethodInvoker)delegate { ShowImage(bmp); }); // return; //} + + if (_previewMonitor.IsShown) { + var bmpShow = (Bitmap)bmp.Clone(); + _previewMonitor.ShowFrame(bmpShow); + if (_lastBmpShow != null) { + _lastBmpShow.Dispose(); + } + _lastBmpShow = bmpShow; + } + picDisplay.Image = bmp; } diff --git a/TIASshot/IScam.cs b/TIASshot/IScam.cs index 142fc1a..d395190 100644 --- a/TIASshot/IScam.cs +++ b/TIASshot/IScam.cs @@ -143,7 +143,10 @@ } _form.ShowImage(_bmps[_bmpIndex]); _bmpIndex = (_bmpIndex + 1) % 2; - if (_bmps[_bmpIndex] != null) _bmps[_bmpIndex].Dispose(); + if (_bmps[_bmpIndex] != null) { + _bmps[_bmpIndex].Dispose(); + _bmps[_bmpIndex] = null; + } return FrameQueuedResult.ReQueue; } diff --git a/TIASshot/PreviewMonitor.Designer.cs b/TIASshot/PreviewMonitor.Designer.cs new file mode 100644 index 0000000..0ebba79 --- /dev/null +++ b/TIASshot/PreviewMonitor.Designer.cs @@ -0,0 +1,147 @@ +namespace TIASshot { + partial class PreviewMonitor { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.picPreview = new System.Windows.Forms.PictureBox(); + this.label1 = new System.Windows.Forms.Label(); + this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.picPreview)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + this.SuspendLayout(); + // + // picPreview + // + this.picPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.picPreview.Location = new System.Drawing.Point(617, 0); + this.picPreview.Name = "picPreview"; + this.picPreview.Size = new System.Drawing.Size(662, 800); + this.picPreview.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.picPreview.TabIndex = 0; + this.picPreview.TabStop = false; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("BIZ UDPゴシック", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); + this.label1.Location = new System.Drawing.Point(78, 326); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(435, 144); + this.label1.TabIndex = 1; + this.label1.Text = "口を大きく開いて\r\n\r\n舌を出してください"; + // + // pictureBox1 + // + this.pictureBox1.Image = global::TIASshot.Properties.Resources.アイコン; + this.pictureBox1.Location = new System.Drawing.Point(12, 72); + this.pictureBox1.Name = "pictureBox1"; + this.pictureBox1.Size = new System.Drawing.Size(133, 132); + this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox1.TabIndex = 2; + this.pictureBox1.TabStop = false; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Font = new System.Drawing.Font("BIZ UDPゴシック", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); + this.label2.Location = new System.Drawing.Point(169, 72); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(397, 24); + this.label2.TabIndex = 3; + this.label2.Text = "千葉大学フロンティア医工学センター"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("BIZ UDPゴシック", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); + this.label3.Location = new System.Drawing.Point(166, 137); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(445, 37); + this.label3.TabIndex = 3; + this.label3.Text = "舌撮影解析システム TIAS"; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("BIZ UDPゴシック", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); + this.label4.Location = new System.Drawing.Point(261, 185); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(345, 19); + this.label4.TabIndex = 4; + this.label4.Text = "Tongue Image Analyzing System"; + this.label4.Click += new System.EventHandler(this.label4_Click); + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Font = new System.Drawing.Font("Segoe UI", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label5.Location = new System.Drawing.Point(26, 538); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(580, 130); + this.label5.TabIndex = 5; + this.label5.Text = "Open your mouth wide \r\nand stick out your tongue."; + // + // PreviewMonitor + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(1280, 800); + this.ControlBox = false; + this.Controls.Add(this.label5); + this.Controls.Add(this.label4); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.pictureBox1); + this.Controls.Add(this.label1); + this.Controls.Add(this.picPreview); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "PreviewMonitor"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.Text = "PreviewMonitor"; + this.TopMost = true; + this.Load += new System.EventHandler(this.PreviewMonitor_Load); + ((System.ComponentModel.ISupportInitialize)(this.picPreview)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.PictureBox picPreview; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.Label label5; + } +} \ No newline at end of file diff --git a/TIASshot/PreviewMonitor.cs b/TIASshot/PreviewMonitor.cs new file mode 100644 index 0000000..6e10da2 --- /dev/null +++ b/TIASshot/PreviewMonitor.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace TIASshot { + public partial class PreviewMonitor : Form { + public bool IsShown { get; private set; } = false; + + public PreviewMonitor() { + InitializeComponent(); + Visible = false; + + } + + private void PreviewMonitor_Load(object sender, EventArgs e) { + // プレビューウィンドウの位置とサイズを設定 + foreach (var scr in Screen.AllScreens) { + if (scr.Primary) continue; // プライマリスクリーンは除外 + if (scr.Bounds.Width <= Config.GetInt("Shot/PreviewMonitorWidth")) { + Location = new Point(scr.Bounds.X, scr.Bounds.Y); + this.Size = scr.Bounds.Size; + IsShown = true; + Visible = true; + } + } + } + + public void ShowFrame(Bitmap bmp) { + if (!IsShown) return; + picPreview.Image = bmp; + } + + private void label4_Click(object sender, EventArgs e) { + + } + } +} diff --git a/TIASshot/PreviewMonitor.resx b/TIASshot/PreviewMonitor.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/TIASshot/PreviewMonitor.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TIASshot/Properties/AssemblyInfo.cs b/TIASshot/Properties/AssemblyInfo.cs index 5ee4463..5dce7a9 100644 --- a/TIASshot/Properties/AssemblyInfo.cs +++ b/TIASshot/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ // ビルド番号 // リビジョン // -[assembly: AssemblyVersion("1.5.0.0")] -[assembly: AssemblyFileVersion("1.5.0.0")] +[assembly: AssemblyVersion("1.6.0.0")] +[assembly: AssemblyFileVersion("1.6.0.0")] diff --git a/TIASshot/Properties/Resources.Designer.cs b/TIASshot/Properties/Resources.Designer.cs index 2e71bd2..96ee7ba 100644 --- a/TIASshot/Properties/Resources.Designer.cs +++ b/TIASshot/Properties/Resources.Designer.cs @@ -4,47 +4,48 @@ // ランタイム バージョン:4.0.30319.42000 // // このファイルへの変更は、以下の状況下で不正な動作の原因になったり、 -// コードが再生成されるときに損失したりします +// コードが再生成されるときに損失したりします。 // //------------------------------------------------------------------------------ namespace TIASshot.Properties { - - + using System; + + /// /// ローカライズされた文字列などを検索するための、厳密に型指定されたリソース クラスです。 /// // このクラスは StronglyTypedResourceBuilder クラスが ResGen // または Visual Studio のようなツールを使用して自動生成されました。 // メンバーを追加または削除するには、.ResX ファイルを編集して、/str オプションと共に - // ResGen を実行し直すか、または VS プロジェクトをリビルドします。 - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + // ResGen を実行し直すか、または VS プロジェクトをビルドし直します。 + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { - + private static global::System.Resources.ResourceManager resourceMan; - + private static global::System.Globalization.CultureInfo resourceCulture; - + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] internal Resources() { } - + /// - /// このクラスで使用されるキャッシュされた ResourceManager インスタンスを返します。 + /// このクラスで使用されているキャッシュされた ResourceManager インスタンスを返します。 /// [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] internal static global::System.Resources.ResourceManager ResourceManager { get { - if ((resourceMan == null)) { + if (object.ReferenceEquals(resourceMan, null)) { global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("TIASshot.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; } } - + /// /// すべてについて、現在のスレッドの CurrentUICulture プロパティをオーバーライドします /// 現在のスレッドの CurrentUICulture プロパティをオーバーライドします。 @@ -58,5 +59,15 @@ resourceCulture = value; } } + + /// + /// 型 System.Drawing.Bitmap のローカライズされたリソースを検索します。 + /// + internal static System.Drawing.Bitmap アイコン { + get { + object obj = ResourceManager.GetObject("アイコン", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } } } diff --git a/TIASshot/Properties/Resources.resx b/TIASshot/Properties/Resources.resx index af7dbeb..ba3f90f 100644 --- a/TIASshot/Properties/Resources.resx +++ b/TIASshot/Properties/Resources.resx @@ -46,7 +46,7 @@ mimetype: application/x-microsoft.net.object.binary.base64 value : The object must be serialized with - : System.Serialization.Formatters.Binary.BinaryFormatter + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter : and then encoded with base64 encoding. mimetype: application/x-microsoft.net.object.soap.base64 @@ -60,6 +60,7 @@ : and then encoded with base64 encoding. --> + @@ -68,9 +69,10 @@ - + + @@ -85,9 +87,10 @@ - + + @@ -109,9 +112,13 @@ 2.0 - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\アイコン.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/TIASshot/TIASshot.csproj b/TIASshot/TIASshot.csproj index a3cd689..25734a4 100644 --- a/TIASshot/TIASshot.csproj +++ b/TIASshot/TIASshot.csproj @@ -129,11 +129,20 @@ + + Form + + + PreviewMonitor.cs + Form1.cs + + PreviewMonitor.cs + ResXFileCodeGenerator Resources.Designer.cs @@ -142,6 +151,7 @@ True Resources.resx + True @@ -160,6 +170,7 @@ + diff --git a/TIASshot/config.xml b/TIASshot/config.xml index c6c1c29..7638372 100644 --- a/TIASshot/config.xml +++ b/TIASshot/config.xml @@ -37,6 +37,7 @@ 17 + 1280 10 500 無記名 diff --git "a/TIASshot/\343\202\242\343\202\244\343\202\263\343\203\263.png" "b/TIASshot/\343\202\242\343\202\244\343\202\263\343\203\263.png" new file mode 100644 index 0000000..5f80253 --- /dev/null +++ "b/TIASshot/\343\202\242\343\202\244\343\202\263\343\203\263.png" Binary files differ