Commit 8e4d028e 张东亮

监控界面

1 个父辈 db9f527e
...@@ -36,6 +36,10 @@ namespace Common ...@@ -36,6 +36,10 @@ namespace Common
public static IntPtr PutIntoForm(Panel panel, string titleName) public static IntPtr PutIntoForm(Panel panel, string titleName)
{ {
IntPtr appWin = FindWindow(null, titleName); IntPtr appWin = FindWindow(null, titleName);
if (appWin == IntPtr.Zero)
{
appWin = GetDesktopWindows(titleName);
}
// Put it into this form // Put it into this form
SetParent(appWin, panel.Handle); SetParent(appWin, panel.Handle);
...@@ -141,7 +145,7 @@ namespace Common ...@@ -141,7 +145,7 @@ namespace Common
public static IntPtr GetDesktopWindows(string windowName, StringComparison comparison = StringComparison.Ordinal) public static IntPtr GetDesktopWindows(string windowName, StringComparison comparison = StringComparison.Ordinal)
{ {
WindowInfo[] allWindow = WindowUtil.GetAllDesktopWindows(); WindowInfo[] allWindow = WindowUtil.GetAllDesktopWindows();
var wnd = allWindow.FirstOrDefault(s => s.szWindowName.Equals(windowName, comparison)); var wnd = allWindow.FirstOrDefault(s => s.szWindowName.StartsWith(windowName, comparison));// s.szWindowName.Equals(windowName, comparison)
return wnd.hWnd; return wnd.hWnd;
} }
} }
......
...@@ -55,10 +55,10 @@ namespace TheMachine ...@@ -55,10 +55,10 @@ namespace TheMachine
this.btn_IgnoreX09 = new System.Windows.Forms.Button(); this.btn_IgnoreX09 = new System.Windows.Forms.Button();
this.btn_PauseBuzzer = new System.Windows.Forms.Button(); this.btn_PauseBuzzer = new System.Windows.Forms.Button();
this.tabMonitor = new System.Windows.Forms.TabPage(); this.tabMonitor = new System.Windows.Forms.TabPage();
this.panelVideo = new System.Windows.Forms.Panel();
this.listView1 = new System.Windows.Forms.ListView(); this.listView1 = new System.Windows.Forms.ListView();
this.btn_stop = new System.Windows.Forms.Button(); this.btn_stop = new System.Windows.Forms.Button();
this.btn_run = new System.Windows.Forms.Button(); this.btn_run = new System.Windows.Forms.Button();
this.panelVideo = new System.Windows.Forms.Panel();
this.menuStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout();
this.tabc.SuspendLayout(); this.tabc.SuspendLayout();
this.tabP1.SuspendLayout(); this.tabP1.SuspendLayout();
...@@ -262,7 +262,7 @@ namespace TheMachine ...@@ -262,7 +262,7 @@ namespace TheMachine
// pictureBox2 // pictureBox2
// //
this.pictureBox2.BackColor = System.Drawing.Color.Gainsboro; this.pictureBox2.BackColor = System.Drawing.Color.Gainsboro;
this.pictureBox2.Location = new System.Drawing.Point(6, 269); this.pictureBox2.Location = new System.Drawing.Point(8, 269);
this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(436, 271); this.pictureBox2.Size = new System.Drawing.Size(436, 271);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
...@@ -329,14 +329,6 @@ namespace TheMachine ...@@ -329,14 +329,6 @@ namespace TheMachine
this.tabMonitor.Text = "监控"; this.tabMonitor.Text = "监控";
this.tabMonitor.UseVisualStyleBackColor = true; this.tabMonitor.UseVisualStyleBackColor = true;
// //
// panelVideo
//
this.panelVideo.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelVideo.Location = new System.Drawing.Point(0, 0);
this.panelVideo.Name = "panelVideo";
this.panelVideo.Size = new System.Drawing.Size(1000, 560);
this.panelVideo.TabIndex = 274;
//
// listView1 // listView1
// //
this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
...@@ -376,6 +368,14 @@ namespace TheMachine ...@@ -376,6 +368,14 @@ namespace TheMachine
this.btn_run.UseVisualStyleBackColor = true; this.btn_run.UseVisualStyleBackColor = true;
this.btn_run.Click += new System.EventHandler(this.btn_run_Click); this.btn_run.Click += new System.EventHandler(this.btn_run_Click);
// //
// panelVideo
//
this.panelVideo.Dock = System.Windows.Forms.DockStyle.Fill;
this.panelVideo.Location = new System.Drawing.Point(0, 0);
this.panelVideo.Name = "panelVideo";
this.panelVideo.Size = new System.Drawing.Size(1000, 560);
this.panelVideo.TabIndex = 276;
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 17F);
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!