473,396 Members | 2,087 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Making Hot Spots on Windows form using transparent buttons??


The needed capability:
I guess there are two possibilities for making "hot
spots" on a Windows Form:

The Scenario:
I have a world map as the form background. I need
clickable hotspots over portions of the world map that
also have tool tip messages.

The Possibilities?:
Option 1:
Place invisible buttons on the area needing a hotspot.
Is this possible to make buttons invisible?

Option 2:
Put the buttons on a separate form of the same size as
the first and set the property of this form to 0%. Then
write code to overlay the form with buttons exactly on
top of the first form needing hotspots...so the world map
is viewable "under" the buttons. Is there sample code
that already does this? Seems a little messy for cases
when the user starts moving forms around. trying to keep
the two on top of one another.

Any other suggestions??

Nov 21 '05 #1
11 6935
"BobAchgill" <an*******@discussions.microsoft.com> schrieb:
The needed capability:
I guess there are two possibilities for making "hot
spots" on a Windows Form:

The Scenario:
I have a world map as the form background. I need
clickable hotspots over portions of the world map that
also have tool tip messages.


Option 3:

Add a handler to a form's (or control's) mouse events and store an
array/collection of regions that represent the hotspots. You can create
regions of arbitrary shape from a 'GraphicsPath' (see 'Region' constructor).
In the 'MouseUp' event, you loop through the regions and check 'IsVisible'
for the mouse position. In the mouse move event, you do the same and adjust
the tooltip's text accordingly. In addition to that, you'll have to provide
keyboard access to the regions.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2
"BobAchgill" <an*******@discussions.microsoft.com> schrieb:
The needed capability:
I guess there are two possibilities for making "hot
spots" on a Windows Form:

The Scenario:
I have a world map as the form background. I need
clickable hotspots over portions of the world map that
also have tool tip messages.


Option 3:

Add a handler to a form's (or control's) mouse events and store an
array/collection of regions that represent the hotspots. You can create
regions of arbitrary shape from a 'GraphicsPath' (see 'Region' constructor).
In the 'MouseUp' event, you loop through the regions and check 'IsVisible'
for the mouse position. In the mouse move event, you do the same and adjust
the tooltip's text accordingly. In addition to that, you'll have to provide
keyboard access to the regions.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3

I lost you "on loop through the regions and
check 'IsVisible' for the mouse position.

Can you steer me to some example remotely like what you
are talking about?

I forgot I also need the feature AccessibleName that
would have come with using an invisible button approach.
I guess that will look something like:
Me.graphicspath.AccessibleName = "MyName"
I think I will be a better programmer after doing it the
way you are suggesting. If I can make it up that little
hill.

I have been wanting to do some thing with graphics so I
guess this is the beginning.

Thanks!
-----Original Message-----
"BobAchgill" <an*******@discussions.microsoft.com> schrieb:
The needed capability:
I guess there are two possibilities for making "hot
spots" on a Windows Form:

The Scenario:
I have a world map as the form background. I need
clickable hotspots over portions of the world map that
also have tool tip messages.


Option 3:

Add a handler to a form's (or control's) mouse events

and store anarray/collection of regions that represent the hotspots. You can createregions of arbitrary shape from a 'GraphicsPath' (see 'Region' constructor).In the 'MouseUp' event, you loop through the regions and check 'IsVisible'for the mouse position. In the mouse move event, you do the same and adjustthe tooltip's text accordingly. In addition to that, you'll have to providekeyboard access to the regions.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

.

Nov 21 '05 #4

I lost you "on loop through the regions and
check 'IsVisible' for the mouse position.

Can you steer me to some example remotely like what you
are talking about?

I forgot I also need the feature AccessibleName that
would have come with using an invisible button approach.
I guess that will look something like:
Me.graphicspath.AccessibleName = "MyName"
I think I will be a better programmer after doing it the
way you are suggesting. If I can make it up that little
hill.

I have been wanting to do some thing with graphics so I
guess this is the beginning.

Thanks!
-----Original Message-----
"BobAchgill" <an*******@discussions.microsoft.com> schrieb:
The needed capability:
I guess there are two possibilities for making "hot
spots" on a Windows Form:

The Scenario:
I have a world map as the form background. I need
clickable hotspots over portions of the world map that
also have tool tip messages.


Option 3:

Add a handler to a form's (or control's) mouse events

and store anarray/collection of regions that represent the hotspots. You can createregions of arbitrary shape from a 'GraphicsPath' (see 'Region' constructor).In the 'MouseUp' event, you loop through the regions and check 'IsVisible'for the mouse position. In the mouse move event, you do the same and adjustthe tooltip's text accordingly. In addition to that, you'll have to providekeyboard access to the regions.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

.

Nov 21 '05 #5

"BobAchgill" <an*******@discussions.microsoft.com> wrote
Option 2:
Put the buttons on a separate form of the same size as
the first and set the property of this form to 0%. Then
write code to overlay the form with buttons exactly on
top of the first form needing hotspots... Any other suggestions??


Option 4
Create a bitmap of the world map such that hotspots are
different colors that helps to index them in an array of
informative items. As the user moves over the world map,
use the X and Y coordinates to get the pixel color information
from the indexed bitmap, and use that index to get information
about the hotspot.

For example, hotspot1 could be colored RGB(0, 0, 1),
hotspot2 = RGB(0, 0, 2), etc... and converting those colors
to indexes, you could look up the needed info from an array.

LFS
Nov 21 '05 #6

"BobAchgill" <an*******@discussions.microsoft.com> wrote
Option 2:
Put the buttons on a separate form of the same size as
the first and set the property of this form to 0%. Then
write code to overlay the form with buttons exactly on
top of the first form needing hotspots... Any other suggestions??


Option 4
Create a bitmap of the world map such that hotspots are
different colors that helps to index them in an array of
informative items. As the user moves over the world map,
use the X and Y coordinates to get the pixel color information
from the indexed bitmap, and use that index to get information
about the hotspot.

For example, hotspot1 could be colored RGB(0, 0, 1),
hotspot2 = RGB(0, 0, 2), etc... and converting those colors
to indexes, you could look up the needed info from an array.

LFS
Nov 21 '05 #7
"BobAchgill" <an*******@discussions.microsoft.com> schrieb:
I lost you "on loop through the regions and
check 'IsVisible' for the mouse position.
\\\
Private m_Regions() As Region
..
..
..
m_Regions = ...
..
..
..
Private Sub Form_MouseMove( _
ByVal sender As Object, _
ByVal e As MouseEventArgs _
) Handles MyBase.MouseMove
For Each r As Region In m_Regions
If r.IsVisible(e.X, e.Y) Then
RegionClicked(r)
Return
End If
Next r
End Sub
///
I forgot I also need the feature AccessibleName that
would have come with using an invisible button approach.
I guess that will look something like:
Me.graphicspath.AccessibleName = "MyName"


Mhm... I currently don't have an idea because the approach described above
doesn't make use of controls.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #8
"BobAchgill" <an*******@discussions.microsoft.com> schrieb:
I lost you "on loop through the regions and
check 'IsVisible' for the mouse position.
\\\
Private m_Regions() As Region
..
..
..
m_Regions = ...
..
..
..
Private Sub Form_MouseMove( _
ByVal sender As Object, _
ByVal e As MouseEventArgs _
) Handles MyBase.MouseMove
For Each r As Region In m_Regions
If r.IsVisible(e.X, e.Y) Then
RegionClicked(r)
Return
End If
Next r
End Sub
///
I forgot I also need the feature AccessibleName that
would have come with using an invisible button approach.
I guess that will look something like:
Me.graphicspath.AccessibleName = "MyName"


Mhm... I currently don't have an idea because the approach described above
doesn't make use of controls.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #9
"Larry Serflaten" <se*******@usinternet.com> schrieb:
Create a bitmap of the world map such that hotspots are
different colors that helps to index them in an array of
informative items. As the user moves over the world map,
use the X and Y coordinates to get the pixel color information
from the indexed bitmap, and use that index to get information
about the hotspot.


Good idea. That works pretty well and is easy to implement. I once
implemented that in VB6 ;-). Still the developer has to care about
accessibility (texts, keyboard access, ...).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #10
"Larry Serflaten" <se*******@usinternet.com> schrieb:
Create a bitmap of the world map such that hotspots are
different colors that helps to index them in an array of
informative items. As the user moves over the world map,
use the X and Y coordinates to get the pixel color information
from the indexed bitmap, and use that index to get information
about the hotspot.


Good idea. That works pretty well and is easy to implement. I once
implemented that in VB6 ;-). Still the developer has to care about
accessibility (texts, keyboard access, ...).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #11
BobAchgill wrote:
(sniP)
Put the buttons on a separate form of the same size as
the first and set the property of this form to 0%.


I thought the lowest value for for transparency was 50%.

and I still haven't thought of a reason to use it!
Nov 21 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: mattaku | last post by:
I have a background image for my form that has an alpha channel (PNG or GIF). I would like my form to become semi-transparent and partially show the desktop. I can figure out how to set the form's...
0
by: BobAchgill | last post by:
The needed capability: I guess there are two possibilities for making "hot spots" on a Windows Form: The Scenario: I have a world map as the form background. I need clickable hotspots over...
0
by: BobAchgill | last post by:
I stumbled across a way to make buttons transparent. Which means its possible to use a button to be a "hot spot" (if a square hot spot is what you need) I found the answer waiting in a very...
9
by: RCS | last post by:
I'm working on an ASP.NET webpage that generates an image (and am using VWD 2005 until my copy of VS2005 ships). I have done all the obvious (and not-so-obvious) things to try to give a gif that I...
1
by: FredC | last post by:
I'm using Visual Studio 2003. I have a form with the following controls on it: - a datagrid - several buttons On the forms property page, I have set the Background to an image. The problem: I...
0
by: Tim Marshall | last post by:
A2003. I rather like the appearance I get with windows themed controls turned on, but I'm running into an odd problem with tab controls. When I set the back style to transparent, it really isn't...
9
by: mohit.akl | last post by:
Hey guys & gals I am havng trouble modifying the control box. I want to make the maximise button invisible and have minimisise button instead of it. Like this _ X (not like _ o X ) How...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
3
by: ApexData | last post by:
I'm starting a new project. A Personnel System. I have considered opening a single bound form to the main employee table. The user can scroll the records to any individual. I would like to have a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.