修改超声工具增加区域截图修复视频采集内存增加BUG
This commit is contained in:
parent
8e7a6b281f
commit
50896f711d
@ -42,6 +42,9 @@
|
||||
<!--HIS获取患者相关 是否读取HIS患者 0 是 1否-->
|
||||
<add key="ishisinfo" value="1"/>
|
||||
|
||||
<!--是否开启区域截图-->
|
||||
<add key="isselectionXY" value="1"/>
|
||||
|
||||
<!--HIS获取患者相关-->
|
||||
<add key="hisGetTokenUrl" value="http://10.55.253.199:8443/api/pacs/getPacsToken"/>
|
||||
<add key="hisGetDataUrl" value="http://10.55.253.199:8443/api/pacs/getpacsdata"/>
|
||||
|
66
ConfigHelper.cs
Normal file
66
ConfigHelper.cs
Normal file
@ -0,0 +1,66 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace videoGather
|
||||
{
|
||||
public static class ConfigHelper
|
||||
{
|
||||
|
||||
private static readonly string ConfigFolder =
|
||||
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Config");
|
||||
|
||||
/// <summary>
|
||||
/// 保存配置到指定名称的配置文件
|
||||
/// </summary>
|
||||
/// <typeparam name="T">配置数据类型</typeparam>
|
||||
/// <param name="configName">配置文件名(无需扩展名)</param>
|
||||
/// <param name="data">配置数据</param>
|
||||
public static void Save<T>(string configName, T data)
|
||||
{
|
||||
if (!Directory.Exists(ConfigFolder))
|
||||
{
|
||||
Directory.CreateDirectory(ConfigFolder);
|
||||
}
|
||||
|
||||
var filePath = GetConfigPath(configName);
|
||||
var json = JsonConvert.SerializeObject(data, Formatting.Indented);
|
||||
File.WriteAllText(filePath, json);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读取指定配置文件的配置数据
|
||||
/// </summary>
|
||||
/// <typeparam name="T">配置数据类型</typeparam>
|
||||
/// <param name="configName">配置文件名(无需扩展名)</param>
|
||||
/// <param name="defaultValue">当配置不存在时的默认值</param>
|
||||
public static T Load<T>(string configName, T defaultValue = default)
|
||||
{
|
||||
var filePath = GetConfigPath(configName);
|
||||
|
||||
if (!File.Exists(filePath))
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var json = File.ReadAllText(filePath);
|
||||
return JsonConvert.DeserializeObject<T>(json);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetConfigPath(string configName)
|
||||
{
|
||||
return Path.Combine(ConfigFolder, $"{configName}.config.json");
|
||||
}
|
||||
}
|
||||
}
|
66
DoubleBufferedPanel.cs
Normal file
66
DoubleBufferedPanel.cs
Normal file
@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace videoGather
|
||||
{
|
||||
public class DoubleBufferedPanel : Panel
|
||||
{
|
||||
|
||||
private Bitmap _backImage;
|
||||
// 新增背景图属性
|
||||
public Bitmap BackImage
|
||||
{
|
||||
get => _backImage;
|
||||
set
|
||||
{
|
||||
if (_backImage != null)
|
||||
{
|
||||
_backImage.Dispose();
|
||||
}
|
||||
_backImage = value;
|
||||
Invalidate(); // 触发重绘
|
||||
}
|
||||
}
|
||||
// 构造函数
|
||||
public DoubleBufferedPanel()
|
||||
{
|
||||
// 启用双缓冲
|
||||
this.DoubleBuffered = true; // 内置支持
|
||||
// 设置样式以避免闪烁
|
||||
this.SetStyle(ControlStyles.OptimizedDoubleBuffer |
|
||||
ControlStyles.AllPaintingInWmPaint |
|
||||
ControlStyles.UserPaint, true);
|
||||
}
|
||||
|
||||
protected override void OnPaintBackground(PaintEventArgs e)
|
||||
{
|
||||
// 禁用默认背景绘制(关键!)
|
||||
// base.OnPaintBackground(e); // 注释掉这行
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
// 绘制自定义背景图
|
||||
if (_backImage != null)
|
||||
{
|
||||
e.Graphics.DrawImage(_backImage, ClientRectangle);
|
||||
}
|
||||
|
||||
base.OnPaint(e); // 保持原有绘制逻辑
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
_backImage?.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
20
SelectionConfig .cs
Normal file
20
SelectionConfig .cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace videoGather
|
||||
{
|
||||
public class SelectionConfig
|
||||
{
|
||||
|
||||
public int X { get; set; }
|
||||
public int Y { get; set; }
|
||||
public int Width { get; set; }
|
||||
public int Height { get; set; }
|
||||
|
||||
// 添加时间戳用于校验
|
||||
public DateTime LastModified { get; set; } = DateTime.Now;
|
||||
}
|
||||
}
|
68
video.Designer.cs
generated
68
video.Designer.cs
generated
@ -34,6 +34,7 @@ namespace videoGather
|
||||
this.btn_Capture = new System.Windows.Forms.Button();
|
||||
this.btn_Close = new System.Windows.Forms.Button();
|
||||
this.gb_ButtonBox = new System.Windows.Forms.GroupBox();
|
||||
this.button7 = new System.Windows.Forms.Button();
|
||||
this.textBox1 = new System.Windows.Forms.TextBox();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.button6 = new System.Windows.Forms.Button();
|
||||
@ -73,7 +74,7 @@ namespace videoGather
|
||||
this.jianchamingcheng = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.kaifangsi = new System.Windows.Forms.DataGridViewTextBoxColumn();
|
||||
this.gb_CameraPanel = new System.Windows.Forms.GroupBox();
|
||||
this.vsp_Panel = new AForge.Controls.VideoSourcePlayer();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
|
||||
this.gb_ButtonBox.SuspendLayout();
|
||||
this.groupBox2.SuspendLayout();
|
||||
@ -81,6 +82,7 @@ namespace videoGather
|
||||
this.groupBox1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dGVPatient)).BeginInit();
|
||||
this.gb_CameraPanel.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// cb_CameraSelect
|
||||
@ -118,6 +120,7 @@ namespace videoGather
|
||||
//
|
||||
// gb_ButtonBox
|
||||
//
|
||||
this.gb_ButtonBox.Controls.Add(this.button7);
|
||||
this.gb_ButtonBox.Controls.Add(this.textBox1);
|
||||
this.gb_ButtonBox.Controls.Add(this.label7);
|
||||
this.gb_ButtonBox.Controls.Add(this.button6);
|
||||
@ -141,12 +144,22 @@ namespace videoGather
|
||||
this.gb_ButtonBox.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.gb_ButtonBox.Name = "gb_ButtonBox";
|
||||
this.gb_ButtonBox.Padding = new System.Windows.Forms.Padding(2);
|
||||
this.gb_ButtonBox.Size = new System.Drawing.Size(556, 235);
|
||||
this.gb_ButtonBox.Size = new System.Drawing.Size(503, 235);
|
||||
this.gb_ButtonBox.TabIndex = 16;
|
||||
this.gb_ButtonBox.TabStop = false;
|
||||
this.gb_ButtonBox.Text = "功能区";
|
||||
this.gb_ButtonBox.Enter += new System.EventHandler(this.gb_ButtonBox_Enter);
|
||||
//
|
||||
// button7
|
||||
//
|
||||
this.button7.Location = new System.Drawing.Point(255, 60);
|
||||
this.button7.Name = "button7";
|
||||
this.button7.Size = new System.Drawing.Size(111, 30);
|
||||
this.button7.TabIndex = 33;
|
||||
this.button7.Text = "选中区域";
|
||||
this.button7.UseVisualStyleBackColor = true;
|
||||
this.button7.Click += new System.EventHandler(this.button7_Click_1);
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
this.textBox1.Location = new System.Drawing.Point(123, 175);
|
||||
@ -168,7 +181,7 @@ namespace videoGather
|
||||
// button6
|
||||
//
|
||||
this.button6.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button6.Location = new System.Drawing.Point(400, 173);
|
||||
this.button6.Location = new System.Drawing.Point(371, 173);
|
||||
this.button6.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.button6.Name = "button6";
|
||||
this.button6.Size = new System.Drawing.Size(127, 31);
|
||||
@ -205,7 +218,7 @@ namespace videoGather
|
||||
// button1
|
||||
//
|
||||
this.button1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button1.Location = new System.Drawing.Point(400, 139);
|
||||
this.button1.Location = new System.Drawing.Point(371, 139);
|
||||
this.button1.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(127, 31);
|
||||
@ -227,7 +240,7 @@ namespace videoGather
|
||||
// button4
|
||||
//
|
||||
this.button4.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button4.Location = new System.Drawing.Point(400, 23);
|
||||
this.button4.Location = new System.Drawing.Point(371, 23);
|
||||
this.button4.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.button4.Name = "button4";
|
||||
this.button4.Size = new System.Drawing.Size(127, 112);
|
||||
@ -255,6 +268,7 @@ namespace videoGather
|
||||
this.lab_Time.Size = new System.Drawing.Size(87, 16);
|
||||
this.lab_Time.TabIndex = 13;
|
||||
this.lab_Time.Text = "00:00:00";
|
||||
this.lab_Time.Visible = false;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
@ -265,6 +279,7 @@ namespace videoGather
|
||||
this.label2.Size = new System.Drawing.Size(87, 16);
|
||||
this.label2.TabIndex = 12;
|
||||
this.label2.Text = "录制时间:";
|
||||
this.label2.Visible = false;
|
||||
//
|
||||
// btn_EndVideo
|
||||
//
|
||||
@ -275,6 +290,7 @@ namespace videoGather
|
||||
this.btn_EndVideo.TabIndex = 11;
|
||||
this.btn_EndVideo.Text = "停止录像(F8)";
|
||||
this.btn_EndVideo.UseVisualStyleBackColor = true;
|
||||
this.btn_EndVideo.Visible = false;
|
||||
this.btn_EndVideo.Click += new System.EventHandler(this.btn_EndVideo_Click);
|
||||
//
|
||||
// btn_PauseVideo
|
||||
@ -286,6 +302,7 @@ namespace videoGather
|
||||
this.btn_PauseVideo.TabIndex = 10;
|
||||
this.btn_PauseVideo.Text = "暂停录像(F7)";
|
||||
this.btn_PauseVideo.UseVisualStyleBackColor = true;
|
||||
this.btn_PauseVideo.Visible = false;
|
||||
this.btn_PauseVideo.Click += new System.EventHandler(this.btn_PauseVideo_Click);
|
||||
//
|
||||
// btn_StartVideo
|
||||
@ -297,6 +314,7 @@ namespace videoGather
|
||||
this.btn_StartVideo.TabIndex = 9;
|
||||
this.btn_StartVideo.Text = "开始录像(F6)";
|
||||
this.btn_StartVideo.UseVisualStyleBackColor = true;
|
||||
this.btn_StartVideo.Visible = false;
|
||||
this.btn_StartVideo.Click += new System.EventHandler(this.btn_StartVideo_Click);
|
||||
//
|
||||
// groupBox2
|
||||
@ -320,7 +338,7 @@ namespace videoGather
|
||||
this.groupBox2.Font = new System.Drawing.Font("宋体", 12F);
|
||||
this.groupBox2.Location = new System.Drawing.Point(3, 17);
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.Size = new System.Drawing.Size(556, 153);
|
||||
this.groupBox2.Size = new System.Drawing.Size(503, 153);
|
||||
this.groupBox2.TabIndex = 18;
|
||||
this.groupBox2.TabStop = false;
|
||||
this.groupBox2.Text = "病理";
|
||||
@ -328,7 +346,7 @@ namespace videoGather
|
||||
// button5
|
||||
//
|
||||
this.button5.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.button5.Location = new System.Drawing.Point(388, 98);
|
||||
this.button5.Location = new System.Drawing.Point(371, 98);
|
||||
this.button5.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.button5.Name = "button5";
|
||||
this.button5.Size = new System.Drawing.Size(127, 31);
|
||||
@ -465,7 +483,7 @@ namespace videoGather
|
||||
this.groupBox3.Dock = System.Windows.Forms.DockStyle.Left;
|
||||
this.groupBox3.Location = new System.Drawing.Point(0, 0);
|
||||
this.groupBox3.Name = "groupBox3";
|
||||
this.groupBox3.Size = new System.Drawing.Size(562, 994);
|
||||
this.groupBox3.Size = new System.Drawing.Size(509, 994);
|
||||
this.groupBox3.TabIndex = 19;
|
||||
this.groupBox3.TabStop = false;
|
||||
this.groupBox3.Text = "操作";
|
||||
@ -479,7 +497,7 @@ namespace videoGather
|
||||
this.groupBox1.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Padding = new System.Windows.Forms.Padding(2);
|
||||
this.groupBox1.Size = new System.Drawing.Size(556, 586);
|
||||
this.groupBox1.Size = new System.Drawing.Size(503, 586);
|
||||
this.groupBox1.TabIndex = 19;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "患者信息";
|
||||
@ -500,7 +518,7 @@ namespace videoGather
|
||||
this.dGVPatient.ReadOnly = true;
|
||||
this.dGVPatient.RowTemplate.Height = 23;
|
||||
this.dGVPatient.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
|
||||
this.dGVPatient.Size = new System.Drawing.Size(552, 563);
|
||||
this.dGVPatient.Size = new System.Drawing.Size(499, 563);
|
||||
this.dGVPatient.TabIndex = 0;
|
||||
this.dGVPatient.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dGVPatient_CellDoubleClick);
|
||||
//
|
||||
@ -551,27 +569,28 @@ namespace videoGather
|
||||
//
|
||||
// gb_CameraPanel
|
||||
//
|
||||
this.gb_CameraPanel.Controls.Add(this.vsp_Panel);
|
||||
this.gb_CameraPanel.Controls.Add(this.pictureBox1);
|
||||
this.gb_CameraPanel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.gb_CameraPanel.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
|
||||
this.gb_CameraPanel.Location = new System.Drawing.Point(562, 0);
|
||||
this.gb_CameraPanel.Location = new System.Drawing.Point(509, 0);
|
||||
this.gb_CameraPanel.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.gb_CameraPanel.Name = "gb_CameraPanel";
|
||||
this.gb_CameraPanel.Padding = new System.Windows.Forms.Padding(2);
|
||||
this.gb_CameraPanel.Size = new System.Drawing.Size(1153, 994);
|
||||
this.gb_CameraPanel.Size = new System.Drawing.Size(1206, 994);
|
||||
this.gb_CameraPanel.TabIndex = 20;
|
||||
this.gb_CameraPanel.TabStop = false;
|
||||
this.gb_CameraPanel.Text = "拍摄";
|
||||
//
|
||||
// vsp_Panel
|
||||
// pictureBox1
|
||||
//
|
||||
this.vsp_Panel.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.vsp_Panel.Location = new System.Drawing.Point(2, 21);
|
||||
this.vsp_Panel.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.vsp_Panel.Name = "vsp_Panel";
|
||||
this.vsp_Panel.Size = new System.Drawing.Size(1149, 971);
|
||||
this.vsp_Panel.TabIndex = 1;
|
||||
this.vsp_Panel.VideoSource = null;
|
||||
this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pictureBox1.BackColor = System.Drawing.SystemColors.ButtonShadow;
|
||||
this.pictureBox1.Location = new System.Drawing.Point(15, 17);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(1186, 720);
|
||||
this.pictureBox1.TabIndex = 1;
|
||||
this.pictureBox1.TabStop = false;
|
||||
this.pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox1_Paint);
|
||||
//
|
||||
// backgroundWorker1
|
||||
//
|
||||
@ -592,7 +611,8 @@ namespace videoGather
|
||||
this.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.Name = "video";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "视频采集";
|
||||
this.Text = "视频采集V6";
|
||||
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
|
||||
this.Load += new System.EventHandler(this.Form1_Load);
|
||||
this.gb_ButtonBox.ResumeLayout(false);
|
||||
@ -604,6 +624,7 @@ namespace videoGather
|
||||
this.groupBox1.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.dGVPatient)).EndInit();
|
||||
this.gb_CameraPanel.ResumeLayout(false);
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
@ -636,7 +657,6 @@ namespace videoGather
|
||||
private System.Windows.Forms.GroupBox groupBox3;
|
||||
private System.Windows.Forms.GroupBox groupBox1;
|
||||
private System.Windows.Forms.GroupBox gb_CameraPanel;
|
||||
private AForge.Controls.VideoSourcePlayer vsp_Panel;
|
||||
private System.Windows.Forms.DataGridView dGVPatient;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
|
||||
private System.Windows.Forms.DataGridViewTextBoxColumn name;
|
||||
@ -654,6 +674,8 @@ namespace videoGather
|
||||
private System.Windows.Forms.Button button6;
|
||||
private System.Windows.Forms.TextBox textBox1;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.Button button7;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,6 +86,10 @@
|
||||
<Reference Include="Dicom.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=3a13f649e28eb09a, processorArchitecture=MSIL">
|
||||
<HintPath>packages\fo-dicom.Desktop.4.0.0\lib\net45\Dicom.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="DirectShowLib, Version=2.1.0.1599, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>bin\x86\Debug\DirectShowLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
@ -104,6 +108,10 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ConfigHelper.cs" />
|
||||
<Compile Include="DoubleBufferedPanel.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ExamRecord.cs" />
|
||||
<Compile Include="ExamRecords.cs" />
|
||||
<Compile Include="FlyHisEcgdataModel.cs" />
|
||||
@ -129,6 +137,7 @@
|
||||
</Compile>
|
||||
<Compile Include="RootObject.cs" />
|
||||
<Compile Include="SaveFile.cs" />
|
||||
<Compile Include="SelectionConfig .cs" />
|
||||
<Compile Include="Series.cs" />
|
||||
<Compile Include="StudyInfo.cs" />
|
||||
<Compile Include="video.cs">
|
||||
|
Loading…
Reference in New Issue
Block a user