Added Icons to keyboard input button

This commit is contained in:
MaxXor 2015-07-29 21:26:50 +02:00
parent 9416b22f46
commit 72c4815ad6
8 changed files with 60 additions and 39 deletions

View File

@ -81,20 +81,20 @@ namespace xClient.Core.Commands
{
case MouseAction.LeftDown:
case MouseAction.LeftUp:
NativeMethodsHelper.DoMouseEventLeft(p, command.IsMouseDown);
NativeMethodsHelper.DoMouseLeftClick(p, command.IsMouseDown);
break;
case MouseAction.RightDown:
case MouseAction.RightUp:
NativeMethodsHelper.DoMouseEventRight(p, command.IsMouseDown);
NativeMethodsHelper.DoMouseRightClick(p, command.IsMouseDown);
break;
case MouseAction.MoveCursor:
NativeMethodsHelper.DoMouseMoveCursor(p);
NativeMethodsHelper.DoMouseMove(p);
break;
case MouseAction.ScrollDown:
NativeMethodsHelper.DoMouseEventScroll(p, true);
NativeMethodsHelper.DoMouseScroll(p, true);
break;
case MouseAction.ScrollUp:
NativeMethodsHelper.DoMouseEventScroll(p, false);
NativeMethodsHelper.DoMouseScroll(p, false);
break;
}
}

View File

@ -13,22 +13,22 @@ namespace xClient.Core.Helper
private const uint KEYEVENTF_KEYDOWN = 0x0000;
private const uint KEYEVENTF_KEYUP = 0x0002;
public static void DoMouseEventLeft(Point p, bool isMouseDown)
public static void DoMouseLeftClick(Point p, bool isMouseDown)
{
NativeMethods.mouse_event(isMouseDown ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP, p.X, p.Y, 0, 0);
}
public static void DoMouseEventRight(Point p, bool isMouseDown)
public static void DoMouseRightClick(Point p, bool isMouseDown)
{
NativeMethods.mouse_event(isMouseDown ? MOUSEEVENTF_RIGHTDOWN : MOUSEEVENTF_RIGHTUP, p.X, p.Y, 0, 0);
}
public static void DoMouseMoveCursor(Point p)
public static void DoMouseMove(Point p)
{
NativeMethods.SetCursorPos(p.X, p.Y);
}
public static void DoMouseEventScroll(Point p, bool scrollDown)
public static void DoMouseScroll(Point p, bool scrollDown)
{
NativeMethods.mouse_event(MOUSEEVENTF_WHEEL, p.X, p.Y, scrollDown ? -120 : 120, 0);
}

View File

@ -28,6 +28,7 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmRemoteDesktop));
this.btnStart = new System.Windows.Forms.Button();
this.btnStop = new System.Windows.Forms.Button();
@ -40,8 +41,8 @@
this.cbMonitors = new System.Windows.Forms.ComboBox();
this.btnHide = new System.Windows.Forms.Button();
this.btnShow = new System.Windows.Forms.Button();
this.toolTipButtons = new System.Windows.Forms.ToolTip(this.components);
this.picDesktop = new xServer.Controls.RapidPictureBox();
this.chkForwardCommandKeys = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.barQuality)).BeginInit();
this.panelTop.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.picDesktop)).BeginInit();
@ -84,7 +85,7 @@
this.lblQuality.AutoSize = true;
this.lblQuality.Location = new System.Drawing.Point(167, 5);
this.lblQuality.Name = "lblQuality";
this.lblQuality.Size = new System.Drawing.Size(46, 13);
this.lblQuality.Size = new System.Drawing.Size(47, 13);
this.lblQuality.TabIndex = 4;
this.lblQuality.Text = "Quality:";
//
@ -104,13 +105,13 @@
this.btnMouse.Name = "btnMouse";
this.btnMouse.Size = new System.Drawing.Size(28, 28);
this.btnMouse.TabIndex = 6;
this.toolTipButtons.SetToolTip(this.btnMouse, "Enable mouse input.");
this.btnMouse.UseVisualStyleBackColor = true;
this.btnMouse.Click += new System.EventHandler(this.btnMouse_Click);
//
// panelTop
//
this.panelTop.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelTop.Controls.Add(this.chkForwardCommandKeys);
this.panelTop.Controls.Add(this.btnKeyboard);
this.panelTop.Controls.Add(this.cbMonitors);
this.panelTop.Controls.Add(this.btnHide);
@ -127,10 +128,12 @@
//
// btnKeyboard
//
this.btnKeyboard.Image = global::xServer.Properties.Resources.keyboard_delete;
this.btnKeyboard.Location = new System.Drawing.Point(336, 5);
this.btnKeyboard.Name = "btnKeyboard";
this.btnKeyboard.Size = new System.Drawing.Size(28, 28);
this.btnKeyboard.TabIndex = 9;
this.toolTipButtons.SetToolTip(this.btnKeyboard, "Enable keyboard input.");
this.btnKeyboard.UseVisualStyleBackColor = true;
this.btnKeyboard.Click += new System.EventHandler(this.btnKeyboard_Click);
//
@ -182,17 +185,6 @@
this.picDesktop.MouseMove += new System.Windows.Forms.MouseEventHandler(this.picDesktop_MouseMove);
this.picDesktop.MouseUp += new System.Windows.Forms.MouseEventHandler(this.picDesktop_MouseUp);
//
// chkForwardCommandKeys
//
this.chkForwardCommandKeys.AutoSize = true;
this.chkForwardCommandKeys.Location = new System.Drawing.Point(234, 39);
this.chkForwardCommandKeys.Name = "chkForwardCommandKeys";
this.chkForwardCommandKeys.Size = new System.Drawing.Size(149, 17);
this.chkForwardCommandKeys.TabIndex = 10;
this.chkForwardCommandKeys.Text = "Forward Command Keys";
this.chkForwardCommandKeys.UseVisualStyleBackColor = true;
this.chkForwardCommandKeys.CheckedChanged += new System.EventHandler(this.chkForwardCommandKeys_CheckedChanged);
//
// FrmRemoteDesktop
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -233,6 +225,6 @@
private xServer.Controls.RapidPictureBox picDesktop;
private System.Windows.Forms.ComboBox cbMonitors;
private System.Windows.Forms.Button btnKeyboard;
private System.Windows.Forms.CheckBox chkForwardCommandKeys;
private System.Windows.Forms.ToolTip toolTipButtons;
}
}

View File

@ -9,6 +9,7 @@ using xServer.Enums;
namespace xServer.Forms
{
//TODO: Register Hotkeys for WIN - and ALT-key combinations
public partial class FrmRemoteDesktop : Form
{
public bool IsStarted { get; private set; }
@ -182,12 +183,14 @@ namespace xServer.Forms
{
this.picDesktop.Cursor = Cursors.Default;
btnMouse.Image = Properties.Resources.mouse_delete;
toolTipButtons.SetToolTip(btnMouse, "Enable mouse input.");
_enableMouseInput = false;
}
else
{
this.picDesktop.Cursor = Cursors.Hand;
btnMouse.Image = Properties.Resources.mouse_add;
toolTipButtons.SetToolTip(btnMouse, "Disable mouse input.");
_enableMouseInput = true;
}
@ -196,7 +199,19 @@ namespace xServer.Forms
private void btnKeyboard_Click(object sender, EventArgs e)
{
_enableKeyboardInput = !_enableKeyboardInput;
if (_enableKeyboardInput)
{
btnKeyboard.Image = Properties.Resources.keyboard_delete;
toolTipButtons.SetToolTip(btnMouse, "Enable keyboard input.");
_enableKeyboardInput = false;
}
else
{
btnKeyboard.Image = Properties.Resources.keyboard_add;
toolTipButtons.SetToolTip(btnMouse, "Disable keyboard input.");
_enableKeyboardInput = true;
}
this.ActiveControl = picDesktop;
}
@ -317,17 +332,5 @@ namespace xServer.Forms
btnHide.Visible = true;
this.ActiveControl = picDesktop;
}
private void chkForwardCommandKeys_CheckedChanged(object sender, EventArgs e)
{
if (chkForwardCommandKeys.Checked)
{
//register hot keys for command keys such as Windows key and ALT + key combinations
}
else
{
}
}
}
}

View File

@ -200,6 +200,26 @@ namespace xServer.Properties {
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap keyboard_add {
get {
object obj = ResourceManager.GetObject("keyboard_add", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap keyboard_delete {
get {
object obj = ResourceManager.GetObject("keyboard_delete", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Sucht eine lokalisierte Ressource vom Typ System.Drawing.Bitmap.
/// </summary>

View File

@ -239,12 +239,18 @@
<data name="application_delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\application_delete.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="keyboard_add" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\keyboard_add.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="logger" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\logger.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="run" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\run.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="registry" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\registry.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="server_disconnect" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\server-disconnect.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@ -255,7 +261,7 @@
<value>..\images\information.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="registry" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\registry.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="keyboard_delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\images\keyboard_delete.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 681 B