Skip to content

Commit

Permalink
Transparent non-clickthroughable form thanks to EveCodeJunkie
Browse files Browse the repository at this point in the history
  • Loading branch information
emist committed Aug 18, 2011
1 parent 3b7984c commit 5d76fbf
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 25 deletions.
4 changes: 2 additions & 2 deletions UI/ClientWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ private void mouseInput_Click(object sender, System.EventArgs e)
Console.WriteLine("Stopping Input");
mouseInput.Text = "Input";

this.Invalidate();
//this.Invalidate();
}
else
{
Console.WriteLine("Starting Input");
mouseInput.Text = "No Input";

this.Invalidate();
//this.Invalidate();
}
isMouse = !isMouse;
}
Expand Down
21 changes: 5 additions & 16 deletions UI/WindowHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,6 @@ public WindowHandler(ClientWindow cw)
dll = items[1];

drawingScreen = new DrawableScreen(cw, this);
//drawingScreen = new Utils();
pipename = RandomString(9);
pipename = "\\\\.\\pipe\\" + pipename;
com = new Communicator(pipename);
Expand Down Expand Up @@ -627,6 +626,8 @@ private void initialize()
pmouse.setWindowHandle(appWin);
keyboard.setWindowHandle(appWin);
mouse.setWindowHandle(appWin);
//drawingScreen.TopLevel = false;
//drawingScreen.Parent = this;

StringBuilder sb = new StringBuilder(300);

Expand Down Expand Up @@ -837,8 +838,6 @@ protected override void OnVisibleChanged(EventArgs e)
//this.Invalidate();
base.OnVisibleChanged(e);



}

/// <summary>
Expand Down Expand Up @@ -868,18 +867,7 @@ protected override void OnHandleDestroyed(EventArgs e)
}


protected override void OnPaint(PaintEventArgs e)
{
if (loaded)
{
//drawingScreen.Invalidate();
drawingScreen.drawString("Eryan 2.0", systemFont, new Point(0, 0));
}


base.OnPaint(e);
}


/// <summary>
/// Update the drawing screen
/// </summary>
Expand Down Expand Up @@ -909,12 +897,13 @@ private void handleDrawingScreen()


drawingScreen.setOwner(this);
//drawingScreen.bringToFront();
drawingScreen.setSize(new Size(this.Size.Width, this.Size.Height));
drawingScreen.setLocation(new Point(cw.Location.X+10, cw.Location.Y+80));
//drawingScreen.setLocation(new Point(this.Location.X+5, this.Location.Y + 50));
//drawingScreen.setBackColor(Color.Transparent);
drawingScreen.setBackColor(Color.Gray);
drawingScreen.setOpacity(0.70);
//drawingScreen.setOpacity(0.70);
//drawingScreen.setTransparencyKey();
drawingScreen.setFormBorderStyle(FormBorderStyle.None);
drawingScreen.setControlBox(false);
Expand Down
15 changes: 10 additions & 5 deletions Util/DrawableScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,19 @@

namespace Eryan.Util
{
/// <summary>
/// The Eryan overlay, for internal use
/// </summary>



public class DrawableScreen : Utils
{


WindowHandler wh;
ClientWindow cw;
PreciseMouse pm;
KeyBoard kb;
Mouse m;

private Font systemFont = new Font("Impact", 16);

[DllImport(@"C:\\mouseDLL.dll")]
public static extern void dllMoveMouse(IntPtr handle, int x, int y);

Expand All @@ -37,6 +36,12 @@ public DrawableScreen(ClientWindow cw, WindowHandler wh) : base()
this.cw = cw;
}

protected override void OnPaint(PaintEventArgs e)
{
drawString("Eryan 2.0", systemFont, new Point(20, 50));
//base.OnPaint(e);
}

protected override void OnMouseMove(MouseEventArgs e)
{
//cw.tabControl1.Invalidate();
Expand Down
10 changes: 10 additions & 0 deletions Util/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,16 @@ public virtual uint getPid()
return pid;
}

protected override CreateParams CreateParams
{
get
{
// Set the WS_EX_TRANSPARENT flag without enabling click-through
CreateParams createParams = base.CreateParams;
createParams.ExStyle |= 0x00000020;
return createParams;
}
}

public void drawString(String str, Font f, Point loc, bool antialiasing)
{
Expand Down
4 changes: 2 additions & 2 deletions app.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
</configuration>
</configuration>

0 comments on commit 5d76fbf

Please sign in to comment.