diff --git a/VAR.Toolbox/UI/Tools/ScreenAutomation/CtrImageViewer.cs b/VAR.Toolbox/UI/Tools/ScreenAutomation/CtrImageViewer.cs deleted file mode 100644 index 082787e..0000000 --- a/VAR.Toolbox/UI/Tools/ScreenAutomation/CtrImageViewer.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System; -using System.Drawing; -using System.Windows.Forms; - -namespace VAR.ScreenAutomation.Controls -{ - public class CtrImageViewer : PictureBox - { - #region Declarations - - private Image _imageShow; - - #endregion - - #region Properties - - public Image ImageShow - { - // ReSharper disable once InconsistentlySynchronizedField - get => _imageShow; - set - { - lock (this) - { - _imageShow = value; - Invalidate(); - } - } - } - - #endregion - - #region Control life cycle - - public CtrImageViewer() - { - InitializeComponent(); - } - - private void InitializeComponent() - { - BackColor = Color.Black; - } - - protected override void OnPaint(PaintEventArgs pe) - { - base.OnPaint(pe); - Redraw(pe.Graphics); - } - - protected override void OnResize(EventArgs e) - { - base.OnResize(e); - //Redraw(null); - this.Invalidate(); - } - - #endregion - - #region Private methods - - private void Redraw(Graphics graph) - { - if (_imageShow == null) - { - return; - } - - lock (_imageShow) - { - if (graph == null) - { - graph = this.CreateGraphics(); - } - - // Calcular dimensiones a dibujar y centrar - int imgDrawWidth; - int imgDrawHeight; - float imgDrawX = 0; - float imgDrawY = 0; - float relation = _imageShow.Width / (float)_imageShow.Height; - if (relation > 0) - { - // Imagen mas ancha que alta - imgDrawHeight = (int)(Width / relation); - if (imgDrawHeight > Height) - { - imgDrawHeight = Height; - imgDrawWidth = (int)(Height * relation); - imgDrawX = ((Width - imgDrawWidth) / 2.0f); - } - else - { - imgDrawWidth = Width; - imgDrawY = ((Height - imgDrawHeight) / 2.0f); - } - } - else - { - // Imagen mas alta que ancha - imgDrawWidth = (int)(Width * relation); - if (imgDrawWidth > Width) - { - imgDrawWidth = Width; - imgDrawHeight = (int)(Height / relation); - imgDrawY = ((Height - imgDrawHeight) / 2.0f); - } - else - { - imgDrawHeight = Height; - imgDrawX = ((Width - imgDrawWidth) / 2.0f); - } - } - - graph.DrawImage(_imageShow, imgDrawX, imgDrawY, imgDrawWidth, imgDrawHeight); - } - } - - #endregion - } -} \ No newline at end of file diff --git a/VAR.Toolbox/UI/Tools/ScreenAutomation/FrmScreenAutomation.Designer.cs b/VAR.Toolbox/UI/Tools/ScreenAutomation/FrmScreenAutomation.Designer.cs index 1708ed8..c92efe8 100644 --- a/VAR.Toolbox/UI/Tools/ScreenAutomation/FrmScreenAutomation.Designer.cs +++ b/VAR.Toolbox/UI/Tools/ScreenAutomation/FrmScreenAutomation.Designer.cs @@ -36,7 +36,7 @@ this.ddlAutomationBot = new System.Windows.Forms.ComboBox(); this.btnStartEnd = new System.Windows.Forms.Button(); this.chkKeepToplevel = new System.Windows.Forms.CheckBox(); - this.picPreview = new VAR.ScreenAutomation.Controls.CtrImageViewer(); + this.picPreview = new VAR.Toolbox.Controls.CtrImageViewer(); this.ctrOutput = new VAR.Toolbox.Controls.CtrOutput(); this.chkClick = new System.Windows.Forms.CheckBox(); ((System.ComponentModel.ISupportInitialize)(this.picCapturer)).BeginInit(); @@ -251,7 +251,7 @@ #endregion private System.Windows.Forms.PictureBox picCapturer; - private Controls.CtrImageViewer picPreview; + private VAR.Toolbox.Controls.CtrImageViewer picPreview; private VAR.Toolbox.Controls.CtrOutput ctrOutput; private System.Windows.Forms.SplitContainer splitMain; private System.Windows.Forms.SplitContainer splitOutput; diff --git a/VAR.Toolbox/VAR.Toolbox.csproj b/VAR.Toolbox/VAR.Toolbox.csproj index cd24b32..2cd7009 100644 --- a/VAR.Toolbox/VAR.Toolbox.csproj +++ b/VAR.Toolbox/VAR.Toolbox.csproj @@ -254,9 +254,6 @@ FrmWebcam.cs - - Component - Form