[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: Transparent Shell question
|
I have that already.
public static void main(String[] args) {
Shell shell = new Shell(SWT.NO_TRIM);
shell.setLayout(new FillLayout());
shell.setBackground(new Color(null, 255, 255, 255));
Background b = new Background(shell, 0); // draws an irregular image
int alpha = 128; //0=transparent, 255=opaque only matters if using
LWA_ALPHA
OS.SetWindowLong(shell.handle, OS.GWL_EXSTYLE, OSEx.WS_EX_LAYERED);
OSEx.SetLayeredWindowAttributes(shell.handle, null, alpha,
OSEx.LWA_COLORKEY);
shell.open();
Display display = shell.getDisplay();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
}
Where OSEX is a native that calls :
public class OSEx {
static {
System.loadLibrary("osex");
}
public static final native boolean SetLayeredWindowAttributes(int hwnd,
RGB crKey,
int bAlpha, int dwFlags);
public static final int LWA_COLORKEY = 1;
public static final int LWA_ALPHA = 2;
public static final int WS_EX_LAYERED = 0x80000;
}
// CPP implementation of SetLayeredWindowAttributes
JNIEXPORT jboolean JNICALL
Java_com_avaya_osex_OSEx_SetLayeredWindowAttributes
(JNIEnv *env, jclass theClass, jint windowHandle, jobject crKey, jint alpha,
jint flags) {
SetLayeredWindowAttributes((HWND)windowHandle, (COLORREF)RGB(255,255,255),
(BYTE)alpha, (DWORD)flags );
return( 0 );
}
"Steve Northover" <steve_northover@xxxxxxxxxx> wrote in message
news:bemnki$1ae$1@xxxxxxxxxxxxxx
> Use SWT.NO_TRIM.
>
> "Ross Yakulis" <yakulis@xxxxxxxxx> wrote in message
> news:bekc50$p3s$1@xxxxxxxxxxxxxx
> > I read the post on Nov 2002 "shell alpha channel transparency" and
> > implemented that solution. (setting the EX_STYLE to layered window
> > and then setting the layered window attributes). So now my shell
> > rectangular area is transparent and I can place my iregular image in it
> and
> > have the
> > shell appear as a non-rectangular window (almost).
> >
> > My problem is that no matter what combination of styles I use,
> > I always get a thin rectangular border, even though the inside
> > area of the shell is transparent. How do I get rid of that border?
The
> > application I an creating is windows only.
> >
> > Ross
> >
> >
>
>
>