[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Transparent Shell question

As for hammering  the EXStyle, I initially did not, that was just to see if
it
would make a difference, it did not.   I was hoping not to have to drag out
the
MS compiler, but it looks like I may have to.  Though if I have to do that
then I may just end up writting the app in MS c++ (yuck).

In reading through the swt source, the checkstylebuts for shell excluded
SWT.NO_BACKGROUND not sure why of if this would matter.
I will try some other things and post another reply if I figure this out.

"Steve Northover" <steve_northover@xxxxxxxxxx> wrote in message
news:beukto$86v$1@xxxxxxxxxxxxxx
> One thing that seems funny in your code is that you hammer GWL_EXSTYLE
> instead of just adding WS_EX_LAYERED to it.  Do you have a functioning C
> example?  If so, it's easy to rewrite it to use the internal Windows
> implementation classes to experiment and see what is wrong.  I wouldn't
> suggest shipping a final product that uses the implementation classes but
> they are handy to see what is going on.  This is exactly the process I use
> when presented with a mystery.
>
> Another possiblilty is to temporarily hack Control.createHandle() to
create
> the window with the appropriate style bits?  Might make a difference?
> (probably not).
>
> "Ross Yakulis" <yakulis@xxxxxxxxx> wrote in message
> news:bemopq$2a7$1@xxxxxxxxxxxxxx
> > 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
> > > >
> > > >
> > >
> > >
> > >
> >
> >
>
>