图像绘制的最佳方式+事件监听?
我需要绘制一个代表网络设备(交换机、路由器)的图像,该图像上的项目(以太网卡)需要监听“可点击”的 onOver 事件。
我设法绘制了一个基本想法来使用绘图区域进行测试,但无法在其上实现监听事件。
有什么建议吗?
此致, FR
PS:测试是使用单一上下文绘制的。
编辑:我使用的是 mono c#,它是一个基于 gtk# 的应用程序。
I need to draw a image representing a network equipment (switch , router) the items on that image ( ethernet cards ) would need to be listening for "clickable" onOver events.
I managed to draw a basic idea to test with using the drawing area but will not be able to implement listening events on it.
Any sugestions?
Best regards,
FR
PS: The test was drawn using a single context.
Edit: I'm using mono c# and it's a gtk# based application.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您正在使用 .NET(您在这个问题上标记了 C#,所以我认为这是安全的)您是否考虑过使用
ImageButton
作为可点击项目?您可以为您想要连接的任何事件定义自定义行为。这只是您所描述的内容的猜测,但听起来用户控件将是该项目的一个很好的存储库。您可以以图形方式定义布局,同时保持代码与将要使用它的内容紧密相关。
Assuming that you're using .NET (you tagged C# on this question so I think that's safe) have you considered using an
ImageButton
for the clickable items? You would be able to define custom behavior for any event you care to wire up.This is just a guess from what you've described, but it sounds like a user control would be a good repository for this project. You can define the layout graphically while keeping the code closely associated with what will be utilizing it.