在单击WPF时设置活动区域 [英] Setting areas active on click on WPF

查看:54
本文介绍了在单击WPF时设置活动区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在左键单击鼠标时设置我的表单的一个小区域,但是那里没有任何东西,只是我背景图片的一个区域......并且在运行时可能会重叠一些透明图片



我在工具箱上找到了一个名为边框的控件,如果将边距设置为0,它就可以隐藏,并且在其事件中有一个名为可编程字段的可编程字段MouseLeftButtonDown ...



我希望放在那里的地方还有其他透明图像层,我不希望它们以任何方式进行交互,只是为了显示并隐藏



这个控件适合我想要的工作吗?或者在点击时设置区域的正确方法是什么?



我尝试过:



< border borderbrush =Black

=borderthickness =0horizo​​ntalalignment =Leftheight =55margin =73,16, 0,0verticalalignment =Topwidth =126mouseleftbuttondown =Border_MouseLeftButtonDown>

I want to set a small area of my form active on left click down of the mouse, but there is nothing there, is just an area of my background picture... and on run time may overlap some transparent pictures

I found on the tool box a control called ''border'' that it can be invisible if you set the margins to 0, and in its events has a programmable field called MouseLeftButtonDown...

below the place i want to put it there are other layers of transparent images that i dont want them to interact in any way , just to be shown and hide

Is this control suitable for the job i want it to do? or else what is the right way to set an area active on click?

What I have tried:

<border borderbrush="Black"
="" borderthickness="0" horizontalalignment="Left" height="55" margin="73,16,0,0" verticalalignment="Top" width="126" mouseleftbuttondown="Border_MouseLeftButtonDown">

推荐答案

因为你只是在说一般,并且有没有真正的概念作为一个活跃的区域,你应该把你的一般鼠标处理程序放在表单级别(无论如何开始)。



那样你可以在任何地方跟踪鼠标命中,从鼠标事件参数中确定目标,并决定处理它或让它隧道向下(默认情况下)。
Since you are only talking "generally", and there is no real concept as an active "area", you should put your "general" mouse handler at the "form level" (starting out anyway).

That way you can track a "mouse hit" anywhere, determine the target from the "mouse event argument", and decide to "handle it" or let it "tunnel" down (by default).


这篇关于在单击WPF时设置活动区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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