Atitit. implementation of the suspended window java Swing C #. NET C + + JS HTML the implementation
1. Create a floating window reference code 1
1.1. Define the hover window , set The This main window reference , in order to double-click in the hover window to reduce the Restore window . and the hover window right-click menu " Show main interface " you need to restore the main window 1
1.2.//Set the main window to close, first close the hover window. and System Tray 1
1.3. Inject the system tray icon and exit the system tray when you exit 2
2. Suspended window structure and significant points 2
2.1. To remove the title bar: 2
2.2. Opacity Transparency 70% 2
2.3. There is no icon in the taskbar 2
2.4. Set Top level Windows 2
2.5.3) to drag the function of the form: just add the following code to a component in the form: 3
2.6. Cursor state change when mouse movement 3
2.7. Right-click popup Menu 3
2.8. Double-click hover window to maximize minimized main window 3
3. Major language implementations 3
3.1. implementation of Java swing 3
3.2. implementation of C#.net 4
3.3. C + + qt implementation 4
3.4. implementation of the Web HTML hover window 4
4. Reference 4
1. Set up the hover window Reference Code 1.1. Defining a hover window,Set Thismain Window Reference,is to double-click in the hover window to shrink and restore the master window.and the hover window right-click menu"Show main interface"you need to restore the main window
M.floatform FLTFM;
FLTFM = new Floatform (this); Define the hover window, set the This main window reference, to double-click in the hover window to reduce the restore to the Master window. As well as the hover window right-click menu "Show main interface" in need of restoring main window ...
Fltfm. Show (); Show
1.2.//Set the main window to close, first close the hover window. and System Tray
New Exitx (). Close (this, delegate {
This.fltfm.Close ();// Close the hover window
Trc4.close ();// Close tray icon
});
1.3. Inject the system tray icon,when you quit, you quit. System Tray
Author :: Old Wow's paw attilax ayron, email:[email protected]
Reprint please indicate source: Http://blog.csdn.net/attilax
2. Suspended window structure andSignificant points2.1. To remove the title bar:
C + + qt is inherited from Qwidget. No tools bar, status bar ... Of course, inheriting from Qmainwindowi is also possible. Setwindowflags (Qt::framelesswindowhint
Swing is using JWindow mode, or: J frame.setundecorated (TRUE);//No Titlbar , Jeig defin in java.awt.Frame
2.2. OpacityTransparency70%
SetAttribute (Qt::wa_translucentbackground, true);
JWindow . SetOpacity (0.7f);
2.3. There is no icon in the taskbar
Setwindowflags (Qt::tool)//tool bar mode
Swing is using JWindow mode .... Use the JFrame mode to also horse the line on the method:
2.4. Set the top level window
Setwindowflags (Qt::windowstaysontophint
Java is
jwindow/j Frame . Setalwaysontop (true);
2.5.3) to drag the function of the form:
Just add the following code to a component in the form: 2.6. The cursor state changes 2.7 when the mouse moves. Right-click Pop-up menu 2.8. Double-tap the hover window to maximize the minimization of the main window 3. The major languages implement 3.1. Java Swingthe implementation
Point Loc = NULL ;
Point tmp = NULL ;
Boolean isdragged = false;
Press Move release
Private void setdragable () {
This . Addmouselistener (new java.awt.event.MouseAdapter () {
Public void mousepressed (java.awt.event.MouseEvent e) {
tmp = New Point (e. GetX (), E.GetY ());
isdragged = true ;
// Jframe.setcursor (New Cursor (Cursor.move_cursor));
}
Public void mousereleased (java.awt.event.MouseEvent e) {
isdragged = false ;
// Jframe.setcursor (New Cursor (Cursor.default_cursor));
}
});
This . Addmousemotionlistener (new java.awt.event.MouseMotionAdapter () {
Public void mousedragged (java.awt.event.MouseEvent e) {
if (isdragged) {
// JFrame. (). x
int x = jFrame. getbounds (). x ;
int y = jFrame. getbounds (). y ;
Loc = New Point (x + e. GetX ()- tmp. x ,
y + e . GetY ()- tmp . y );
JFrame . setlocation (loc);
}
}
});
}
3.2. C#.netthe implementation3.3. C + + qtthe implementation3.4. Web HTMLimplementation of the suspended window
4. Reference
java- How to remove The Maximize minimize and close button on JFrame _linux programming _linux commune -linux System portal Site . htm
Paip. Summary of the c#.net suspension window -attilax 's Column - Blog channel -CSDN.NET.htm
Paip. enhance the user experience ---C + + qt Suspension Window Implementation -Attilax 's Column - Blog Channel -CSDN.NET.htm
Atitit. Implementation of the suspended window Java Swing C #. NET C + + JS HTML