From: Lance Wynn on
It didn't work on my system either. I am running XP in a VM, but, if I use
an ocx control to make an entire form transparent that I had lying around
from a long time ago, that works fine. But it won't work if I pass it the
hWnd of a control on the form.

It must be something with the graphics card..


From: Mike Williams on
"DanS" <t.h.i.s.n.t.h.a.t(a)a.d.e.l.p.h.i.a.n.e.t> wrote in message
news:Xns9990E2F311D41thisnthatadelphianet(a)216.196.97.142...

> Well I tried it again. New project, added 1 listbox, 2 picture
> boxes, changed the name of the image file in the code to load
> kitty.jpg instead of what was there....no transparency.
> A screenshots here, it looks just like a standard listbox.

Perhaps your system is having trouble with the AlphaBlend function, which is
what effectively sets the opacity. There is only one call to Alphablend, and
that is the call near the bottom of the Form's Load event. What happens if
you comment out that line, so that it does not execute? You should get full
transparency.

Another possibility, which seems quite likely looking at your screenshot, is
that the pattern brush is not being created for some reason on your system.
As far as I know only Win95 machines should have problems in that area, but
perhaps some graphics cards also have problems with it on other machines?
The first thing to do (just as a test) is to make the size of your ListBoxes
much smaller. Does that change anything?

Also, try temporarily placing an additional line in the SubClassListBox
function in the module code to display the brush handle in the Form's
caption. At least we'll then know whether the brush is being created or not.
The modified code should look like this:

Public Function SubClassListBox(OnOff As Boolean, _
ContainerControl As PictureBox, ListCtl As ListBox, _
PicBack As PictureBox) As Long
If OnOff = True Then
ContainerWnd = ContainerControl.hwnd
ListBoxWnd = ListCtl.hwnd
BackgroundBrush = CreatePatternBrush(PicBack.Image.Handle)
Form1.Caption = Hex(BackgroundBrush) ' <<< this new line added

There's got to be a reason why this code works on some systems and not
others, and I'm sure we'll pin it down sooner or later :-)

Mike


From: Mike Williams on
"DanS" <t.h.i.s.n.t.h.a.t(a)a.d.e.l.p.h.i.a.n.e.t> wrote in message
news:Xns9990E2F311D41thisnthatadelphianet(a)216.196.97.142...

.. . . another thing I've just thought of is the possibility that your system
is having problems creating a full screen Autoredraw image (which is what an
Autoredraw Form requires), or that it's having problems creating the two
Autoredraw Picture Boxes after it has done so. I've come across such things
occasionally on some systems with low available memory or poor graphics
capabilities. It isn't very likely though, because if that was the case the
Autoredraw failure would be notified to you as a VB runtime error message.
It might be worth setting your systems display resolution to a lower setting
though, just temporarily for test pusposes. Try running it at 800 x 600 and
see what happens. If the screen resolution or Autoredraw turns out to be the
problem then we'll be able to find a way of tackling it, although I must
admit it's not the likely cause of your problem.

Mike




From: Norm on
Lance Wynn wrote:
> It didn't work on my system either. I am running XP in a VM, but, if
> I use an ocx control to make an entire form transparent that I had
> lying around from a long time ago, that works fine. But it won't
> work if I pass it the hWnd of a control on the form.
>
> It must be something with the graphics card..


I wonder if Lance and Dan are using a picture with part white background? If
so move the list box to a darker part of the form. I thought at first it was
not working here also, but it was on a white part of the background and just
did not look transparent. Moving the list box to the lower part of the form
showed that it was transparent.
--
Norm

Don't blame me, my programming is
self-taught and my teacher was not
very experienced. :-)

normfowler_don't use_(a)hotmail.com


From: Norm on
Mike,

Very nice effect. Is it possible to do this on a form that is not full
screen?

I only tried once to set the form size back to what it was before making
transparent, but get a message that cannot set the size on a form that is
maximized.

I will fool with it later, now it is time to go back to bed. :-)

Norm

Don't blame me, my programming is
self-taught and my teacher was not
very experienced. :-)

normfowler_don't use_(a)hotmail.com