使用透明按钮在Windows窗体上制作热点? [英] Making Hot Spots on Windows form using transparent buttons??

查看:91
本文介绍了使用透明按钮在Windows窗体上制作热点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



所需的能力:

我想有两种可能性来制作热点/b $ b点。在Windows窗体上:


场景:

我有一张世界地图作为表格背景。我需要

点击世界地图部分的可点击热点

也有工具提示消息。


可能性?:

选项1:

在需要热点的区域放置隐形按钮。

是否可以使按钮不可见?


选项2:

将按钮放在与第一个相同大小的单独表格上,并将此表格的属性设置为0%。然后

编写代码以覆盖表单上的按钮完全在

首先需要热点的表格顶部...所以世界地图

是可见的在...之下按钮。有样品代码

已经这样做了吗?当用户开始移动表格时,似乎有点麻烦的情况

。试图保持

两个在彼此之上。


任何其他建议??


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

推荐答案

" BobAchgill" <一个******* @ discussions.microsoft.com> schrieb:
"BobAchgill" <an*******@discussions.microsoft.com> schrieb:
所需的能力:
我猜有两种可能性来制作热点。在Windows窗体上:

场景:
我有一个世界地图作为表单背景。我需要点击世界地图部分的可点击热点,
也有工具提示消息。
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.




选项3:


为表单'(或控件')的鼠标事件添加处理程序,并存储

数组/代表热点的区域集合。您可以从''GraphicsPath'创建任意形状的
区域(参见''Region''构造函数)。

在''MouseUp''事件中,你循环遍历区域并检查''IsVisible''

的鼠标位置。在鼠标移动事件中,您也会这样做并相应地调整工具提示的文本

。除此之外,你还必须提供

键盘访问这些地区。


-

MS Herfried K. Wagner

MVP< URL:http://dotnet.mvps.org/>

VB< URL:http://dotnet.mvps.org / dotnet / faqs />



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


" BobAchgill" <一个******* @ discussions.microsoft.com> schrieb:
"BobAchgill" <an*******@discussions.microsoft.com> schrieb:
所需的能力:
我猜有两种可能性来制作热点。在Windows窗体上:

场景:
我有一个世界地图作为表单背景。我需要点击世界地图部分的可点击热点,
也有工具提示消息。
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.




选项3:


为表单'(或控件')的鼠标事件添加处理程序,并存储

数组/代表热点的区域集合。您可以从''GraphicsPath'创建任意形状的
区域(参见''Region''构造函数)。

在''MouseUp''事件中,你循环遍历区域并检查''IsVisible''

的鼠标位置。在鼠标移动事件中,您也会这样做并相应地调整工具提示的文本

。除此之外,你还必须提供

键盘访问这些地区。


-

MS Herfried K. Wagner

MVP< URL:http://dotnet.mvps.org/>

VB< URL:http://dotnet.mvps.org / dotnet / faqs />



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




我已经失去了你环游地区和

检查''IsVisible''是否为鼠标位置。


你能引导我一些远程的例子,就像你在谈论的那样吗?


我忘记了我还需要使用隐形按钮方法来获得

的功能AccessibleName。

我想这会看起来像这样:

Me.graphicspath.AccessibleName =" MyName"

我认为我做完后会成为更好的程序员

你建议的方式。如果我可以弥补那个小小的

山。


我一直想用图形做一些事情所以我

猜猜这是开始。


谢谢!

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!
-----原始消息-----
" BobAchgill" <一个******* @ discussions.microsoft.com>
schrieb:
-----Original Message-----
"BobAchgill" <an*******@discussions.microsoft.com> schrieb:
所需的能力:
我猜有两种可能性来制作热点。在Windows窗体上:

场景:
我有一个世界地图作为表单背景。我需要点击世界地图部分的可点击热点
还有工具提示消息。
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.



选项3:

添加一个表单'(或控件')鼠标事件的处理程序



Option 3:

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



并存储代表
热点的区域的集合/集合。你可以从''GraphicsPath''
创建任意形状的区域(参见''Region''构造函数)。在''MouseUp''事件中,你遍历区域并且
检查''IsVisible ''为鼠标位置。在鼠标移动事件中,您可以相同地执行
并相应地调整工具提示的文本。除此之外,
你必须提供键盘访问这些地区。

- MS Herfried K. Wagner
MVP< URL:http ://dotnet.mvps.org/>
VB< URL:http://dotnet.mvps.org/dotnet/faqs/>


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

.



这篇关于使用透明按钮在Windows窗体上制作热点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆