C# create an image that follows the mouse -


i'm trying create program within winform in c# image follow mouse outside application.

i have no clue how draw image outside of form, let alone have follow mouse. solution going - create borderless form , have follow mouse - solution not work because cannot move form via code.

the mouse needs able click , function independently image.

how go doing this?

it must without changing way mouse used.

set ws_ex_transparent extended styles make form ignore mouse clicks. set topmost true , opacity less 100% make semi-transparent. move form timer. like:

public partial class form1 : form {      public form1()     {         initializecomponent();         this.opacity = .5;         this.topmost = true;         this.backcolor = color.yellow;         this.formborderstyle = system.windows.forms.formborderstyle.none;          // makes form circular:         system.drawing.drawing2d.graphicspath gp = new system.drawing.drawing2d.graphicspath();         gp.addellipse(this.clientrectangle);         this.region = new region(gp);     }      const int ws_ex_transparent = 0x20;      protected override system.windows.forms.createparams createparams     {                 {             createparams cp = base.createparams;             cp.exstyle = cp.exstyle | ws_ex_transparent;             return cp;         }     }      private void timer1_tick(object sender, eventargs e)     {         point pt = cursor.position;         pt.offset(-1 * this.width / 2, -1 * this.height / 2);         this.location = pt;     }  } 

Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -