⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mycust.java

📁 自己建立的项目
💻 JAVA
字号:
package com.swtSample.customControl;

import org.eclipse.swt.SWT;
import org.eclipse.swt.internal.win32.OS;
import org.eclipse.swt.internal.win32.TCHAR;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class MyCust {
	public static void main(String [] args){
     Display display = new Display(); 
     Shell shell = new Shell(display , SWT.NULL); 
     shell.setMaximized(false); 
     shell.setBackground(display.getSystemColor(SWT.COLOR_BLACK)); 
     shell.setText("Example"); 
     shell.setBounds(0 , 700 , 1024 , 68); 
     
     //始终最前
     OS.SetWindowPos(shell.handle , OS.HWND_TOPMOST, 0 , 700 , 1024 , 68 , SWT.NULL); 

     //透明窗体
     OS.SetWindowLong(shell.handle , OS.GWL_EXSTYLE , OS.GetWindowLong(shell.handle , OS.GWL_EXSTYLE)^0x80000); 

     TCHAR lpLibFileName = new TCHAR (0, "User32.dll", true); 
     int hInst = OS.LoadLibrary(lpLibFileName); 
     if(hInst != 0){
         String name = "SetLayeredWindowAttributes\0"; 
         byte[] lpProcName = new byte[name.length()]; 
         for(int i=0; i<lpProcName.length; i++){
             lpProcName [i] = (byte) name.charAt(i); 
         }
         int fun = OS.GetProcAddress(hInst , lpProcName); 
         if(fun != 0){
             OS.CallWindowProc(fun , shell.handle , 0,50,1); 
         }
         OS.FreeLibrary(hInst); 
     }
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -