wpf - Some questions about Windows Presentation Foundation (C#) -


i working on program contains (among other things) wpf window using next code maximize @ mousedoubleclick event:

       this.windowstyle = windowstyle.none;                    this.windowstate = windowstate.maximized;              this.topmost = true;   

now, want when window maximized , mouse exits screen (goes bottom of screen until exits screen) new window appear @ bottom of screen(wpf or windowsform) contains several things (buttons, scrollbars, etc) , active long mouse on (just in bsplayer). question how ? i'm starter wpf, don't know xaml , prefer as can using c# code. so: how know when mouse leaves screen , how make window appear on bottom of screen (without minimizing or doing else original window) ? tried using this.mouseleave doesn't work when window maximized.

and if asking question here, use chance ask 2 other things:

  1. when wpf window maximized , if mouse hasn't been moved more 5 seconds, want mouse hidden , become visible again when mouse moves. how do ?
  2. when wpf window not maximized, want border of screen small, invisible (no minimize, close or other button). using this.windowstyle = system.windows.windowstyle.toolwindow still leaves exit/close button there; if use this.windowstyle = system.windows.windowstyle.none looks perfect, can't move window. there anyway make window movable windowstyle.none ? preferably, when keep mouse pressed on interior of screen, want able drag wpf window around on screen.

really need these problems. it's pretty important project working on.

answer question

when wpf window maximized , if mouse hasn't been moved more 5 seconds, want mouse hidden , become visible again when mouse moves. how do ?

this can achieved using timer interval of 5 seconds. when timer elapse set mouse cursor none hide , when mouse moves, reset mouse cursor original one.

put below code in constructor:

 this.mousemove += new mouseeventhandler(mainwindow_mousemove);         tm = new system.timers.timer();         tm.interval = 5000;         tm.elapsed += new system.timers.elapsedeventhandler(tm_elapsed);         tm.start(); 

below event defination:

void mainwindow_mousemove(object sender, mouseeventargs e)     {         tm.stop();         tm.start();          // reseting time original. here have assumed original 1 arrow.         this.dispatcher.invoke(new action(() =>         {             mouse.overridecursor = cursors.arrow;         }));     }      void tm_elapsed(object sender, system.timers.elapsedeventargs e)     {          this.dispatcher.invoke(new action(() =>         {             if (mouse.overridecursor != cursors.none)             {                 mouse.overridecursor = cursors.none;                 currentcursor = mouse.overridecursor;             }         }));     } 

hope helps !!


Comments

Popular posts from this blog

php - get table cell data from and place a copy in another table -

javascript - Mootools wait with Fx.Morph start -

php - Navigate throught databse rows -