drag and drop windows in python gui code example
Example 1: JOptionPane with drop down list java
package com.mkyong.inputDialog;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
public class InputDialog6a {
public static void main(String[] args) {
String[] options = {"I adore turtles", "Yes", "Maybe", "Urm...", "No", "Hate them"};
ImageIcon icon = new ImageIcon("src/images/turtle32.png");
String n = (String)JOptionPane.showInputDialog(null, "Do you like turtles??",
"I like turtles", JOptionPane.QUESTION_MESSAGE, icon, options, options[2]);
System.out.println(n);
}
}
Copy
Example 2: vb.net drag window without titlebar
Public Const WM_NCLBUTTONDOWN As Integer = &HA1
Public Const HT_CAPTION As Integer = &H2
<DllImportAttribute("user32.dll")> _
Public Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
End Function
<DllImportAttribute("user32.dll")> _
Public Shared Function ReleaseCapture() As Boolean
End Function
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown, Panel1.MouseDown
If e.Button = Windows.Forms.MouseButtons.Left Then
ReleaseCapture()
SendMessage(Handle, WM_NCLBUTTONDOWN, HT_CAPTION, 0)
End If
End Sub