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.
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.