From d7116687f58b313bd46895e6f040f408994fe231 Mon Sep 17 00:00:00 2001 From: "Valeriano A.R" Date: Sat, 2 Nov 2019 22:33:31 +0100 Subject: [PATCH] FrmScreenAutomation: Variable FPS selector. --- .../FrmScreenAutomation.Designer.cs | 60 ++++++++++++++----- VAR.ScreenAutomation/FrmScreenAutomation.cs | 3 +- 2 files changed, 46 insertions(+), 17 deletions(-) diff --git a/VAR.ScreenAutomation/FrmScreenAutomation.Designer.cs b/VAR.ScreenAutomation/FrmScreenAutomation.Designer.cs index 62c443f..9b2f5f8 100644 --- a/VAR.ScreenAutomation/FrmScreenAutomation.Designer.cs +++ b/VAR.ScreenAutomation/FrmScreenAutomation.Designer.cs @@ -33,6 +33,7 @@ this.splitOutput = new System.Windows.Forms.SplitContainer(); this.ddlAutomationBot = new System.Windows.Forms.ComboBox(); this.btnStartEnd = new System.Windows.Forms.Button(); + this.numFPS = new System.Windows.Forms.NumericUpDown(); this.picPreview = new VAR.ScreenAutomation.Controls.CtrImageViewer(); this.ctrOutput = new VAR.ScreenAutomation.Controls.CtrOutput(); ((System.ComponentModel.ISupportInitialize)(this.picCapturer)).BeginInit(); @@ -44,19 +45,20 @@ this.splitOutput.Panel1.SuspendLayout(); this.splitOutput.Panel2.SuspendLayout(); this.splitOutput.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numFPS)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.picPreview)).BeginInit(); this.SuspendLayout(); // // picCapturer // - this.picCapturer.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.picCapturer.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.picCapturer.Location = new System.Drawing.Point(4, 4); this.picCapturer.Margin = new System.Windows.Forms.Padding(4); this.picCapturer.Name = "picCapturer"; this.picCapturer.Padding = new System.Windows.Forms.Padding(10); - this.picCapturer.Size = new System.Drawing.Size(424, 799); + this.picCapturer.Size = new System.Drawing.Size(501, 799); this.picCapturer.TabIndex = 0; this.picCapturer.TabStop = false; // @@ -76,7 +78,7 @@ // this.splitMain.Panel2.Controls.Add(this.picCapturer); this.splitMain.Size = new System.Drawing.Size(754, 816); - this.splitMain.SplitterDistance = 309; + this.splitMain.SplitterDistance = 232; this.splitMain.TabIndex = 3; // // splitOutput @@ -92,59 +94,83 @@ // // splitOutput.Panel2 // + this.splitOutput.Panel2.Controls.Add(this.numFPS); this.splitOutput.Panel2.Controls.Add(this.ddlAutomationBot); this.splitOutput.Panel2.Controls.Add(this.btnStartEnd); this.splitOutput.Panel2.Controls.Add(this.ctrOutput); - this.splitOutput.Size = new System.Drawing.Size(309, 816); - this.splitOutput.SplitterDistance = 371; + this.splitOutput.Size = new System.Drawing.Size(232, 816); + this.splitOutput.SplitterDistance = 283; this.splitOutput.TabIndex = 4; // // ddlAutomationBot // - this.ddlAutomationBot.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.ddlAutomationBot.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.ddlAutomationBot.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.ddlAutomationBot.FormattingEnabled = true; this.ddlAutomationBot.Location = new System.Drawing.Point(13, 4); this.ddlAutomationBot.Name = "ddlAutomationBot"; - this.ddlAutomationBot.Size = new System.Drawing.Size(293, 24); + this.ddlAutomationBot.Size = new System.Drawing.Size(216, 24); this.ddlAutomationBot.TabIndex = 4; this.ddlAutomationBot.SelectedIndexChanged += new System.EventHandler(this.DdlAutomationBot_SelectedIndexChanged); // // btnStartEnd // - this.btnStartEnd.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.btnStartEnd.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.btnStartEnd.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.btnStartEnd.Location = new System.Drawing.Point(15, 34); this.btnStartEnd.Name = "btnStartEnd"; - this.btnStartEnd.Size = new System.Drawing.Size(294, 39); + this.btnStartEnd.Size = new System.Drawing.Size(149, 39); this.btnStartEnd.TabIndex = 3; this.btnStartEnd.Text = "Start"; this.btnStartEnd.UseVisualStyleBackColor = true; this.btnStartEnd.Click += new System.EventHandler(this.BtnStartEnd_Click); // + // numFPS + // + this.numFPS.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.numFPS.Location = new System.Drawing.Point(170, 50); + this.numFPS.Maximum = new decimal(new int[] { + 60, + 0, + 0, + 0}); + this.numFPS.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numFPS.Name = "numFPS"; + this.numFPS.Size = new System.Drawing.Size(59, 22); + this.numFPS.TabIndex = 5; + this.numFPS.Value = new decimal(new int[] { + 20, + 0, + 0, + 0}); + // // picPreview // - this.picPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + 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.BackColor = System.Drawing.Color.Black; this.picPreview.ImageShow = null; this.picPreview.Location = new System.Drawing.Point(12, 12); this.picPreview.Name = "picPreview"; - this.picPreview.Size = new System.Drawing.Size(294, 356); + this.picPreview.Size = new System.Drawing.Size(217, 268); this.picPreview.TabIndex = 1; this.picPreview.TabStop = false; // // ctrOutput // - this.ctrOutput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.ctrOutput.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.ctrOutput.Location = new System.Drawing.Point(12, 79); this.ctrOutput.Name = "ctrOutput"; - this.ctrOutput.Size = new System.Drawing.Size(294, 349); + this.ctrOutput.Size = new System.Drawing.Size(217, 437); this.ctrOutput.TabIndex = 2; this.ctrOutput.Text = "ctrOutput1"; // @@ -167,6 +193,7 @@ this.splitOutput.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitOutput)).EndInit(); this.splitOutput.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.numFPS)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.picPreview)).EndInit(); this.ResumeLayout(false); @@ -181,6 +208,7 @@ private System.Windows.Forms.SplitContainer splitOutput; private System.Windows.Forms.Button btnStartEnd; private System.Windows.Forms.ComboBox ddlAutomationBot; + private System.Windows.Forms.NumericUpDown numFPS; } } diff --git a/VAR.ScreenAutomation/FrmScreenAutomation.cs b/VAR.ScreenAutomation/FrmScreenAutomation.cs index 400b1ab..2697599 100644 --- a/VAR.ScreenAutomation/FrmScreenAutomation.cs +++ b/VAR.ScreenAutomation/FrmScreenAutomation.cs @@ -40,7 +40,7 @@ namespace VAR.ScreenAutomation if (components == null) { components = new Container(); } timTicker = new Timer(components) { - Interval = 100, + Interval = Convert.ToInt32(1000 / numFPS.Value), }; timTicker.Tick += TimTicker_Tick; timTicker.Enabled = true; @@ -70,6 +70,7 @@ namespace VAR.ScreenAutomation } picPreview.ImageShow = bmpScreen; + timTicker.Interval = Convert.ToInt32(1000 / numFPS.Value); timTicker.Enabled = true; timTicker.Start(); }