Stephen Lebans' PictureBox Class - Transparent option?

P

Peter Danes

I needed a run-time-manipulable image control on an Access form. A search of
the newsgroup archives revealed many references to Stephen's PictureBox
class, which I downloaded and turned out to be pretty much exactly what I
wanted. But a bit further into the project, I came across something I wanted
to add, but doesn't seem to be a feature in the class, or if it is, I
haven't been smart enough to figure it out.

Project explanation: Fairly simple database, where the main relation
describes a set of lichens found in various parts of the Czech Republic.
There are a few ancillary relations used primarily as lookup tables, but
they have nothing to do with this. The old form simply displayed text data
in bound TextBoxes, but I was asked to add a mapping feature, where the
OnCurrent event of a form triggers a query, which looks up in the very same
relation ALL other records with the same taxonomic identification, groups
them by location (to eliminate duplicates) and plots the location where they
were found on a map. I've got that working pretty well, taking out all the
demonstration routines I didn't need, like random polygons and adding a few
of my own, like drawing a grid.

(Stephen, if you read this and are curious about how I used your control,
I'll be happy to send you a copy of the database. It's about 5 Meg in action
and 2 Meg zipped. And whether or not what I want to do now is feasible, it's
still a great job. Many, many thanks for creating such a useful control.)

What I want to add now is a sort of layer effect. The grid and datapoints
are plotted over the top of an existing map, but I want to go one step
further and make the map transparent, so I can display something else
underneath. What I would like to end up with is the following:
1. Two possible backgrounds, one a satellite image and the other a composite
map off the Czech equivalent of MapQuest.
2. Datapoints and grid drawn over whatever else is displayed.
3. A drawn map between 1 and 2 showing only rivers and some geographic
boundaries.

Points 1 & 2 are under control, the PictureBox class made that a fairly
straightforward programming exercise.
Point 3 is where I am stuck now. I've photoshopped the map image into a
black and white gif of the correct size and displaying it is no problem, but
I would like the white part to be transparent, that is, only display the
black rivers and let one of the two backgrounds show through instead of
displaying white in the areas between rivers. The routine that displays the
drawn map could probably be modified to draw only where there is black, but
it's a sizable image and since it has to be redrawn on every display, it
would probably mean an unacceptable performance hit. Besides which, I've
been looking at the image via code and haven't yet figured out how it's
encoded, so I can't tell what is white and what is black, so I can't even
test such a routine yet, because I don't know what I'm looking at.

Is there some 'transparent' property that I overlooked in studying the
class? If not, could one be added without too much fuss? I'm fairly
competent in standard VBA/Access stuff, but subclassing, DIBSections and
such are a bit over my head.

--


Pete


This e-mail address is fake to keep spammers and their auto-harvesters out
of my hair. If you need to get in touch personally, I am 'pdanes' and I use
Yahoo mail. But please use the newsgroups whenever possible, so that all may
benefit from the exchange of ideas.
 
S

Stephen Lebans

Hi Peter,
please EMail me your project as I would enjoy having a look at it.

Transparency is not natively supported within Access. I have coded a
workaound here but am not sure if it will help you in your specific
case.
http://www.lebans.com/transparent.htm
Transparency is achieved by creating a Metafile containing the desired
transparency mask.

Really what needs to be done is what you stated. You need to render the
individual Bitmaps yourself, masking as required to achieve
transparency. With a relativly modern computer running Win2K or higher,
screen refreshes will not be an issue.

Let me know how you make or if you need any help.

--
HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top