如何在IDesignerhost中获取鼠标事件? [英] How to get mouse events in IDesignerhost?

查看:160
本文介绍了如何在IDesignerhost中获取鼠标事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用IDesignerhost构建设计器应用程序.
我必须在设计器中绘制形状(线,矩形,折线).
为此,我需要获取鼠标事件. Idesignerhost中不会触发鼠标事件.

I am building a designer application using IDesignerhost.
I have to draw shapes (line, rectangle, polyline) in the designer.
For that I need to get mouse events. Mouse events are not triggered in Idesignerhost.

Can any one please help me?

推荐答案

我的代码在VB中,但解决方案在设计器的GetHitTest方法中找到.在设计期间,此方法拦截鼠标事件.如果返回True,它将在设计的控件的代码中引发相应的鼠标事件;否则将返回False.我相信默认情况下GetHitTest返回False,因此,除非您重写它,否则控件在设计时将不会处理鼠标事件.

在Internet上搜索GetHitTest,您会发现足够多的示例来帮助您入门.
The code I have is in VB, but the solution is found in the designer''s GetHitTest method. During design time, this method intercepts mouse events; if it returns True it will raise the corresponding mouse event in the designed control''s code; otherwise it will return False. I believe that GetHitTest returns False by default, so unless you override it your control will not process mouse events at design time.

Do an Internet search for GetHitTest and you will find more than enough examples to get you started.


Gregory.Gadow,

感谢您的答复.

我正在使用此链接中提供的Designerdesigner的Microsoft示例
http://support.microsoft.com/kb/813808 [
Hi Gregory.Gadow,

Thanks for your reply.

I am using the microsoft sample of designerhost provided in this link
http://support.microsoft.com/kb/813808[^


I am having designerhost as a control not as control designer.
There is no abstract method GetHitTest to override.

Thank you,
Gangarani Rajendran


这篇关于如何在IDesignerhost中获取鼠标事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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