mirror of https://github.com/quasar/Quasar.git
Small fixes
This commit is contained in:
parent
ec39581dc3
commit
58167f32a6
|
@ -1,59 +0,0 @@
|
|||
namespace xServer.Controls
|
||||
{
|
||||
partial class PictureBoxEx
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
|
||||
// Stop running.
|
||||
this.Stop();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.picDesktop = new System.Windows.Forms.PictureBox();
|
||||
((System.ComponentModel.ISupportInitialize)(this.picDesktop)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// picDesktop
|
||||
//
|
||||
this.picDesktop.BackColor = System.Drawing.Color.Black;
|
||||
this.picDesktop.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.picDesktop.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.picDesktop.Location = new System.Drawing.Point(0, 0);
|
||||
this.picDesktop.Name = "picDesktop";
|
||||
this.picDesktop.Size = new System.Drawing.Size(797, 501);
|
||||
this.picDesktop.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.picDesktop.TabIndex = 0;
|
||||
this.picDesktop.TabStop = false;
|
||||
((System.ComponentModel.ISupportInitialize)(this.picDesktop)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PictureBox picDesktop;
|
||||
}
|
||||
}
|
|
@ -1,181 +0,0 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using xServer.Core.Utilities;
|
||||
|
||||
namespace xServer.Controls
|
||||
{
|
||||
public delegate void PictureSizeChangedEventHandler(int width, int height);
|
||||
|
||||
public class PictureSizeChangedEventArgs : EventArgs
|
||||
{
|
||||
public int NewWidth;
|
||||
public int NewHeight;
|
||||
|
||||
public PictureSizeChangedEventArgs(int width, int height)
|
||||
{
|
||||
NewWidth = width;
|
||||
NewHeight = height;
|
||||
}
|
||||
}
|
||||
|
||||
public interface IRapidPictureBox
|
||||
{
|
||||
bool Running { get; set; }
|
||||
|
||||
void Start();
|
||||
void Stop();
|
||||
void UpdateImage(Bitmap bmp, bool cloneBitmap = false);
|
||||
|
||||
Image _Image { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Custom PictureBox Control designed for rapidly-changing images.
|
||||
/// </summary>
|
||||
public partial class PictureBoxEx : PictureBox, IRapidPictureBox
|
||||
{
|
||||
#region IRapidPictureBox Implementation
|
||||
|
||||
/// <summary>
|
||||
/// True if the PictureBox should be currently streaming images; False if the
|
||||
/// PictureBox should not be currently streaming images.
|
||||
/// </summary>
|
||||
public bool Running { get; set; }
|
||||
|
||||
public void Start()
|
||||
{
|
||||
_frameCounter = new FrameCounter();
|
||||
|
||||
_sWatch = Stopwatch.StartNew();
|
||||
|
||||
Running = true;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
if (_sWatch != null)
|
||||
_sWatch.Stop();
|
||||
|
||||
Running = false;
|
||||
}
|
||||
|
||||
public void UpdateImage(Bitmap bmp, bool cloneBitmap = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
CountFps();
|
||||
|
||||
if ((bmpWidth != bmp.Width) && (bmpHeight != bmp.Height))
|
||||
OnPictureSizeChanged(new PictureSizeChangedEventArgs(bmp.Width, bmp.Height));
|
||||
|
||||
lock (ImgLocker)
|
||||
{
|
||||
if (this._Image != null)
|
||||
{
|
||||
this._Image.Dispose();
|
||||
this._Image = null;
|
||||
}
|
||||
|
||||
this._Image = cloneBitmap ? new Bitmap(bmp, picDesktop.Width, picDesktop.Height) /*resize bitmap*/ : bmp;
|
||||
}
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(
|
||||
string.Format(
|
||||
"An unexpected error occurred: {0}\n\nPlease report this as fast as possible here:\\https://github.com/MaxXor/xRAT/issues",
|
||||
ex.Message), "", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// Fields used to keep track of the remote desktop's size.
|
||||
public int bmpWidth { get; private set; }
|
||||
public int bmpHeight { get; private set; }
|
||||
|
||||
// Fields for the FrameCounter.
|
||||
public FrameCounter _frameCounter;
|
||||
private Stopwatch _sWatch;
|
||||
|
||||
public PictureBoxEx()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
//this.DoubleBuffered = true;
|
||||
this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
|
||||
|
||||
_frameCounter = new FrameCounter();
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
public event PictureSizeChangedEventHandler PictureSizeChanged;
|
||||
|
||||
protected virtual void OnPictureSizeChanged(PictureSizeChangedEventArgs e)
|
||||
{
|
||||
PictureSizeChangedEventHandler handler = PictureSizeChanged;
|
||||
if (handler != null)
|
||||
handler(e.NewWidth, e.NewHeight);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Overrides
|
||||
|
||||
protected override CreateParams CreateParams
|
||||
{
|
||||
get
|
||||
{
|
||||
CreateParams cp = base.CreateParams;
|
||||
cp.ExStyle |= 0x02000000; // Turn on WS_EX_COMPOSITED
|
||||
return cp;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pe)
|
||||
{
|
||||
lock (ImgLocker)
|
||||
{
|
||||
if (this._Image != null)
|
||||
{
|
||||
pe.Graphics.DrawImage(this._Image, this.Location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void CountFps()
|
||||
{
|
||||
var deltaTime = (float)_sWatch.Elapsed.TotalSeconds;
|
||||
_sWatch = Stopwatch.StartNew();
|
||||
|
||||
_frameCounter.Update(deltaTime);
|
||||
}
|
||||
|
||||
private readonly object ImgLocker = new object();
|
||||
/// <summary>
|
||||
/// Provides thread-safe access to the PictureBox's image.
|
||||
/// </summary>
|
||||
public Image _Image
|
||||
{
|
||||
get
|
||||
{
|
||||
return picDesktop.Image;
|
||||
}
|
||||
set
|
||||
{
|
||||
lock (ImgLocker)
|
||||
{
|
||||
picDesktop.Image = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,126 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="picDesktop.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -0,0 +1,195 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using xServer.Core.Utilities;
|
||||
|
||||
namespace xServer.Controls
|
||||
{
|
||||
public interface IRapidPictureBox
|
||||
{
|
||||
bool Running { get; set; }
|
||||
Image GetImageSafe { get; set; }
|
||||
|
||||
void Start();
|
||||
void Stop();
|
||||
void UpdateImage(Bitmap bmp, bool cloneBitmap = false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Custom PictureBox Control designed for rapidly-changing images.
|
||||
/// </summary>
|
||||
public class RapidPictureBox : PictureBox, IRapidPictureBox
|
||||
{
|
||||
/// <summary>
|
||||
/// True if the PictureBox is currently streaming images, else False.
|
||||
/// </summary>
|
||||
public bool Running { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the width of the original screen.
|
||||
/// </summary>
|
||||
public int ScreenWidth { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns the height of the original screen.
|
||||
/// </summary>
|
||||
public int ScreenHeight { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Provides thread-safe access to the Image of this Picturebox.
|
||||
/// </summary>
|
||||
public Image GetImageSafe
|
||||
{
|
||||
get
|
||||
{
|
||||
return Image;
|
||||
}
|
||||
set
|
||||
{
|
||||
lock (_imageLock)
|
||||
{
|
||||
Image = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The lock object for the Picturebox's image.
|
||||
/// </summary>
|
||||
private readonly object _imageLock = new object();
|
||||
|
||||
/// <summary>
|
||||
/// The Stopwatch for internal FPS measuring.
|
||||
/// </summary>
|
||||
private Stopwatch _sWatch;
|
||||
|
||||
/// <summary>
|
||||
/// The internal class for FPS measuring.
|
||||
/// </summary>
|
||||
private FrameCounter _frameCounter;
|
||||
|
||||
/// <summary>
|
||||
/// Subscribes an Eventhandler to the FrameUpdated event.
|
||||
/// </summary>
|
||||
/// <param name="e">The Eventhandler to set.</param>
|
||||
public void SetFrameUpdatedEvent(FrameUpdatedEventHandler e)
|
||||
{
|
||||
_frameCounter.FrameUpdated += e;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unsubscribes an Eventhandler from the FrameUpdated event.
|
||||
/// </summary>
|
||||
/// <param name="e">The Eventhandler to remove.</param>
|
||||
public void UnsetFrameUpdatedEvent(FrameUpdatedEventHandler e)
|
||||
{
|
||||
_frameCounter.FrameUpdated -= e;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Starts the internal FPS measuring.
|
||||
/// </summary>
|
||||
public void Start()
|
||||
{
|
||||
_frameCounter = new FrameCounter();
|
||||
|
||||
_sWatch = Stopwatch.StartNew();
|
||||
|
||||
Running = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stops the internal FPS measuring.
|
||||
/// </summary>
|
||||
public void Stop()
|
||||
{
|
||||
if (_sWatch != null)
|
||||
_sWatch.Stop();
|
||||
|
||||
Running = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the Image of this Picturebox.
|
||||
/// </summary>
|
||||
/// <param name="bmp">The new bitmap to use.</param>
|
||||
/// <param name="cloneBitmap">If True the bitmap will be cloned, else it uses the original bitmap.</param>
|
||||
public void UpdateImage(Bitmap bmp, bool cloneBitmap = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
CountFps();
|
||||
|
||||
if ((ScreenWidth != bmp.Width) && (ScreenHeight != bmp.Height))
|
||||
UpdateScreenSize(bmp.Width, bmp.Height);
|
||||
|
||||
lock (_imageLock)
|
||||
{
|
||||
if (GetImageSafe != null)
|
||||
{
|
||||
GetImageSafe.Dispose();
|
||||
GetImageSafe = null;
|
||||
}
|
||||
|
||||
GetImageSafe = cloneBitmap ? new Bitmap(bmp, Width, Height) /*resize bitmap*/ : bmp;
|
||||
}
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
MessageBox.Show(
|
||||
string.Format(
|
||||
"An unexpected error occurred: {0}\n\nPlease report this as fast as possible here:\\https://github.com/MaxXor/xRAT/issues",
|
||||
ex.Message), "", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor, sets Picturebox double-buffered and initializes the Framecounter.
|
||||
/// </summary>
|
||||
public RapidPictureBox()
|
||||
{
|
||||
this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
|
||||
|
||||
_frameCounter = new FrameCounter();
|
||||
}
|
||||
|
||||
protected override CreateParams CreateParams
|
||||
{
|
||||
get
|
||||
{
|
||||
CreateParams cp = base.CreateParams;
|
||||
cp.ExStyle |= 0x02000000; // Turn on WS_EX_COMPOSITED
|
||||
return cp;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pe)
|
||||
{
|
||||
lock (_imageLock)
|
||||
{
|
||||
if (GetImageSafe != null)
|
||||
{
|
||||
pe.Graphics.DrawImage(GetImageSafe, Location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateScreenSize(int newWidth, int newHeight)
|
||||
{
|
||||
ScreenWidth = newWidth;
|
||||
ScreenHeight = newHeight;
|
||||
}
|
||||
|
||||
private void CountFps()
|
||||
{
|
||||
var deltaTime = (float)_sWatch.Elapsed.TotalSeconds;
|
||||
_sWatch = Stopwatch.StartNew();
|
||||
|
||||
_frameCounter.Update(deltaTime);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -30,9 +30,9 @@ public class FrameCounter
|
|||
|
||||
public void Update(float deltaTime)
|
||||
{
|
||||
float CurrentFramesPerSecond = 1.0f / deltaTime;
|
||||
float currentFramesPerSecond = 1.0f / deltaTime;
|
||||
|
||||
_sampleBuffer.Enqueue(CurrentFramesPerSecond);
|
||||
_sampleBuffer.Enqueue(currentFramesPerSecond);
|
||||
|
||||
if (_sampleBuffer.Count > MAXIMUM_SAMPLES)
|
||||
{
|
||||
|
@ -41,7 +41,7 @@ public void Update(float deltaTime)
|
|||
}
|
||||
else
|
||||
{
|
||||
AverageFramesPerSecond = CurrentFramesPerSecond;
|
||||
AverageFramesPerSecond = currentFramesPerSecond;
|
||||
}
|
||||
|
||||
OnFrameUpdated(new FrameUpdatedEventArgs(AverageFramesPerSecond));
|
||||
|
|
|
@ -35,7 +35,7 @@ private void InitializeComponent()
|
|||
this.lblQuality = new System.Windows.Forms.Label();
|
||||
this.lblQualityShow = new System.Windows.Forms.Label();
|
||||
this.btnMouse = new System.Windows.Forms.Button();
|
||||
this.picDesktop = new xServer.Controls.PictureBoxEx();
|
||||
this.picDesktop = new xServer.Controls.RapidPictureBox();
|
||||
this.panelTop = new System.Windows.Forms.Panel();
|
||||
this.cbMonitors = new System.Windows.Forms.ComboBox();
|
||||
this.btnHide = new System.Windows.Forms.Button();
|
||||
|
@ -111,9 +111,11 @@ private void InitializeComponent()
|
|||
this.picDesktop.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.picDesktop.Cursor = System.Windows.Forms.Cursors.Default;
|
||||
this.picDesktop.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.picDesktop.GetImageSafe = null;
|
||||
this.picDesktop.Location = new System.Drawing.Point(0, 0);
|
||||
this.picDesktop.Name = "picDesktop";
|
||||
this.picDesktop.Size = new System.Drawing.Size(797, 501);
|
||||
this.picDesktop.Running = false;
|
||||
this.picDesktop.Size = new System.Drawing.Size(784, 562);
|
||||
this.picDesktop.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.picDesktop.TabIndex = 0;
|
||||
this.picDesktop.TabStop = false;
|
||||
|
@ -171,15 +173,14 @@ private void InitializeComponent()
|
|||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(797, 501);
|
||||
this.ClientSize = new System.Drawing.Size(784, 562);
|
||||
this.Controls.Add(this.btnShow);
|
||||
this.Controls.Add(this.panelTop);
|
||||
this.Controls.Add(this.picDesktop);
|
||||
this.Font = new System.Drawing.Font("Segoe UI", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.KeyPreview = true;
|
||||
this.MinimizeBox = false;
|
||||
this.MinimumSize = new System.Drawing.Size(570, 421);
|
||||
this.MinimumSize = new System.Drawing.Size(640, 480);
|
||||
this.Name = "FrmRemoteDesktop";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "xRAT 2.0 - Remote Desktop []";
|
||||
|
@ -205,7 +206,7 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.Panel panelTop;
|
||||
private System.Windows.Forms.Button btnHide;
|
||||
private System.Windows.Forms.Button btnShow;
|
||||
private xServer.Controls.PictureBoxEx picDesktop;
|
||||
private xServer.Controls.RapidPictureBox picDesktop;
|
||||
private System.Windows.Forms.ComboBox cbMonitors;
|
||||
}
|
||||
}
|
|
@ -13,24 +13,19 @@ namespace xServer.Forms
|
|||
{
|
||||
public partial class FrmRemoteDesktop : Form
|
||||
{
|
||||
private readonly Client _connectClient;
|
||||
private bool _enableMouseInput;
|
||||
private bool _started;
|
||||
|
||||
private int _screenWidth;
|
||||
private int _screenHeight;
|
||||
|
||||
public readonly Queue<GetDesktopResponse> ProcessingScreensQueue = new Queue<GetDesktopResponse>();
|
||||
public readonly object ProcessingScreensLock = new object();
|
||||
public bool ProcessingScreens;
|
||||
|
||||
private readonly Client _connectClient;
|
||||
private bool _enableMouseInput;
|
||||
private bool _started;
|
||||
|
||||
public FrmRemoteDesktop(Client c)
|
||||
{
|
||||
_connectClient = c;
|
||||
_connectClient.Value.FrmRdp = this;
|
||||
InitializeComponent();
|
||||
|
||||
picDesktop.PictureSizeChanged += picDesktop_PictureSizeChanged;
|
||||
}
|
||||
|
||||
private void FrmRemoteDesktop_Load(object sender, EventArgs e)
|
||||
|
@ -85,7 +80,7 @@ public void ProcessScreens(object state)
|
|||
{
|
||||
try
|
||||
{
|
||||
// Update the new image from the packet data.
|
||||
// update the new image from the packet data
|
||||
picDesktop.UpdateImage(_connectClient.Value.StreamCodec.DecodeData(ms), true);
|
||||
|
||||
this.Invoke((MethodInvoker)delegate
|
||||
|
@ -97,7 +92,8 @@ public void ProcessScreens(object state)
|
|||
});
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
packet.Image = null;
|
||||
|
@ -136,12 +132,6 @@ private void _frameCounter_FrameUpdated(FrameUpdatedEventArgs e)
|
|||
});
|
||||
}
|
||||
|
||||
private void picDesktop_PictureSizeChanged(int width, int height)
|
||||
{
|
||||
_screenWidth = width;
|
||||
_screenHeight = height;
|
||||
}
|
||||
|
||||
private void ToggleControls(bool t)
|
||||
{
|
||||
_started = !t;
|
||||
|
@ -171,8 +161,8 @@ private void FrmRemoteDesktop_FormClosing(object sender, FormClosingEventArgs e)
|
|||
|
||||
private void FrmRemoteDesktop_Resize(object sender, EventArgs e)
|
||||
{
|
||||
panelTop.Left = (this.Width / 2) - (panelTop.Width / 2);
|
||||
btnShow.Left = (this.Width / 2) - (btnShow.Width / 2);
|
||||
panelTop.Left = (this.Width/2) - (panelTop.Width/2);
|
||||
btnShow.Left = (this.Width/2) - (btnShow.Width/2);
|
||||
}
|
||||
|
||||
private void btnStart_Click(object sender, EventArgs e)
|
||||
|
@ -189,7 +179,7 @@ private void btnStart_Click(object sender, EventArgs e)
|
|||
picDesktop.Start();
|
||||
|
||||
// Subscribe to the new frame counter.
|
||||
picDesktop._frameCounter.FrameUpdated += _frameCounter_FrameUpdated;
|
||||
picDesktop.SetFrameUpdatedEvent(_frameCounter_FrameUpdated);
|
||||
|
||||
new Core.Packets.ServerPackets.GetDesktop(barQuality.Value, cbMonitors.SelectedIndex, RemoteDesktopAction.Start).Execute(_connectClient);
|
||||
}
|
||||
|
@ -202,7 +192,7 @@ private void btnStop_Click(object sender, EventArgs e)
|
|||
picDesktop.Stop();
|
||||
|
||||
// Unsubscribe from the frame counter. It will be re-created when starting again.
|
||||
picDesktop._frameCounter.FrameUpdated -= _frameCounter_FrameUpdated;
|
||||
picDesktop.UnsetFrameUpdatedEvent(_frameCounter_FrameUpdated);
|
||||
}
|
||||
|
||||
private void barQuality_Scroll(object sender, EventArgs e)
|
||||
|
@ -238,12 +228,12 @@ private void btnMouse_Click(object sender, EventArgs e)
|
|||
|
||||
private int GetRemoteWidth(int localX)
|
||||
{
|
||||
return localX * _screenWidth / picDesktop.Width;
|
||||
return localX * picDesktop.ScreenWidth / picDesktop.Width;
|
||||
}
|
||||
|
||||
private int GetRemoteHeight(int localY)
|
||||
{
|
||||
return localY * _screenHeight / picDesktop.Height;
|
||||
return localY * picDesktop.ScreenHeight / picDesktop.Height;
|
||||
}
|
||||
|
||||
private void picDesktop_MouseDown(object sender, MouseEventArgs e)
|
||||
|
|
|
@ -71,12 +71,9 @@
|
|||
<Compile Include="Controls\MainMenuEx.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\PictureBoxEx.cs">
|
||||
<Compile Include="Controls\RapidPictureBox.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Controls\PictureBoxEx.Designer.cs">
|
||||
<DependentUpon>PictureBoxEx.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Core\Build\IconInjector.cs" />
|
||||
<Compile Include="Core\Helper\FileHelper.cs" />
|
||||
<Compile Include="Core\Helper\FormatHelper.cs" />
|
||||
|
@ -378,9 +375,6 @@
|
|||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Settings\ProfileManager.cs" />
|
||||
<Compile Include="Settings\Settings.cs" />
|
||||
<EmbeddedResource Include="Controls\PictureBoxEx.resx">
|
||||
<DependentUpon>PictureBoxEx.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\FrmAbout.resx">
|
||||
<DependentUpon>FrmAbout.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
|
|
Loading…
Reference in New Issue