本文将为您提供关于可可–NSWindow:通过窗口将鼠标事件传递给下面的任何内容的详细介绍,我们还将为您解释窗口移动可通过鼠标的相关知识,同时,我们还将为您提供关于c#–如何在不收听框架控件中定义的任
本文将为您提供关于可可 – NSWindow:通过窗口将鼠标事件传递给下面的任何内容的详细介绍,我们还将为您解释窗口移动可通过鼠标的相关知识,同时,我们还将为您提供关于c# – 如何在不收听框架控件中定义的任何鼠标事件的情况下检测鼠标点击?、HTML – 可能吗? – 一个div叠加层,它被鼠标事件完全忽略(这样鼠标事件只影响下面的div)、javascript – 将鼠标事件传播到模糊元素、macos – 将鼠标光标更改为不活动的NSWindow的实用信息。
本文目录一览:- 可可 – NSWindow:通过窗口将鼠标事件传递给下面的任何内容(窗口移动可通过鼠标)
- c# – 如何在不收听框架控件中定义的任何鼠标事件的情况下检测鼠标点击?
- HTML – 可能吗? – 一个div叠加层,它被鼠标事件完全忽略(这样鼠标事件只影响下面的div)
- javascript – 将鼠标事件传播到模糊元素
- macos – 将鼠标光标更改为不活动的NSWindow
可可 – NSWindow:通过窗口将鼠标事件传递给下面的任何内容(窗口移动可通过鼠标)
我使用NSWindow来创建桌面叠加层,但是仍然可以与其他窗口进行交互,即使它们位于我的覆盖窗口后面.
解决方法
c# – 如何在不收听框架控件中定义的任何鼠标事件的情况下检测鼠标点击?
是否可以在不收听框架控件中定义的任何鼠标事件的情况下检测鼠标点击?
我的意思是,我不想写代码如下:
control.MouseLeftButtonDown += this.HandleMouseLeftButtonDown;
但我想知道用户是否点击了屏幕.是否有可能在C#(WPF或Silverlight)?
解决方法:
您可以在主窗口的静态构造函数中注册类处理程序,例如:
static MainWindow() {
EventManager.RegisterClassHandler(typeof (MainWindow),
Mouse.MouseDownEvent,
new MouseButtonEventHandler(OnGlobaMouseDown));
}
它将是所有MouseDown事件的全局处理程序.
HTML – 可能吗? – 一个div叠加层,它被鼠标事件完全忽略(这样鼠标事件只影响下面的div)
问题是这个重叠的div将优先于任何鼠标事件,因此它使下面的交互式谷歌地图无用.必须有一种方法可以让重叠的div忽略鼠标事件,让下面的div得到它们. (拜托,拜托!)
或者,还有另一种方法吗?
这是输出的代码:
<div id="pageWrapper"https://www.jb51.cc/tag/dis/" target="_blank">display: block; "> <div> <div id="pageShadow"></div> <div id="pageMap"><p><iframe width="1096" height="462" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&source=s_q&hl=en&geocode=&q=Baked+Beans+B.V.+i.o.,+Amsterdam,+Nederland&sll=52.365721,4.891641&sspn=0.008648,0.022724&ie=UTF8&hq=baked+beans+bv+io&hnear=Amsterdam,+north+Holland,+The+Netherlands&ll=52.363837,4.891109&spn=0.01664,0.045447&z=14&iwloc=near&cid=2617758725349562441&output=embed"></iframe></p> </div> </div> <div id="page_description"> <p>Text about the company</p> </div> <div id="page_credits"> <div>Job 1</div> <div><p>Description</p> </div> <div>Job 2</div> <div><p>Description</p> </div> <div></div> <div></div> </div> </div>
这是相关的CSS:
#pageWrapper { position: relative; } .page_content { max-height: 462px; position: relative; } #pageShadow { position: absolute; top:0; left: 0; -moz-opacity: .5; opacity:.5; filter: alpha(opacity=50); background-color: aqua; z-index: 300; min-height:462px; min-width: 1096px; } #pageMap { position: absolute; top:0; left: 0; z-index: 299; min-height:462px; min-width: 1096px; } .recTitle { color: #333; font-size: 21px; font-family: 'ProximaNovalight','Helvetica Neue',Helvetica,Arial,sans-serif; padding-left: 3px; padding-bottom: 16px; } .recTitle:first-child { padding-top: 10px; } .recJob { padding-left: 3px; padding-bottom: 30px; } #page_description { position: absolute; top:462px; font-family: 'ProximaNovalight',sans-serif; font-size: 17px; float:left; width:792px; padding: 15px; padding-top:20px; line-height: 22px; font-weight: normal; min-height: 345px; background-color: white; } #page_credits { position: absolute; top:462px; left:822px; padding: 15px 10px 15px 10px; float:right; width:254px; background-color: #f5f5f5; min-height: 350px; }
这就是我想要达到的效果:(顶部的阴影效果)
div overlay http://baked-beans.tv/bb/wp-content/uploads/site-dev/google-map-inner-shadow-div-overlay.jpg
解决方法
http://hacks.mozilla.org/2009/12/pointer-events-for-html-in-firefox-3-6/
Webkit浏览器可能会有支持,如css-Tricks的这篇文章所述:
http://css-tricks.com/pointer-events-current-nav/
但不是在IE或Opera中.
javascript – 将鼠标事件传播到模糊元素
解决方法
macos – 将鼠标光标更改为不活动的NSWindow
-(void)resetCursorRects { NSImage *image = [NSImage imageNamed:@"cursor.png"]; [image setSize:NSMakeSize(32,32)]; NSCursor *cursor = [[NSCursor alloc] initWithImage:image hotSpot:NSMakePoint(1,1)]; [super resetCursorRects]; [self addCursorRect:[self bounds] cursor:cursor]; }
这将改变整个窗口的光标,我将看到cursor.png而不是默认的鼠标指针.问题是,这只有在MYWindow设置为关键窗口时才有效,这当然是非常重要的.
在我的项目开始时我只有一个主窗口,但现在我需要有两个不同的MYWindow.两个窗口的问题是不能将它们都设置为关键窗口,因此自定义鼠标指针仅显示在活动窗口上.我需要单击其他窗口以显示光标.
有没有办法解决?所以我在两个窗口上都有一个自定义光标?
编辑:尝试过NSTrackingArea
我将此添加到我的内容视图的init方法中:
self.trackingArea = [[NSTrackingArea alloc] initWithRect:[self frame] options: (NSTrackingCursorUpdate | NSTrackingActiveAlways | NSTrackingMouseMoved) owner:self userInfo:nil]; [self addTrackingArea:self.trackingArea];
然后我重写了cursorUpdate:像这样:
-(void)cursorUpdate:(NSEvent *)event { NSLog(@"event : %@",event); [[NSCursor crosshairCursor] set]; }
这使得crosshairCursor在包含NSImageView派生类的NSWindow是关键窗口时显示.但是如果我在应用程序的关键窗口中创建另一个NSWindow,则光标会再次返回标准光标.难道我做错了什么?
解决方法
编辑:
我能够使用以下代码使用它:
- (vod)someSetup; { NSTrackingArea *const trackingArea = [[NSTrackingArea alloc] initWithRect:NSZeroRect options: (NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways | NSTrackingInVisibleRect) owner:self userInfo:nil]; [self.view addTrackingArea:trackingArea]; } - (void)mouseEntered:(NSEvent *)theEvent; { [[NSCursor IBeamCursor] push]; } - (void)mouseExited:(NSEvent *)theEvent; { [[NSCursor IBeamCursor] pop]; }
关于可可 – NSWindow:通过窗口将鼠标事件传递给下面的任何内容和窗口移动可通过鼠标的问题就给大家分享到这里,感谢你花时间阅读本站内容,更多关于c# – 如何在不收听框架控件中定义的任何鼠标事件的情况下检测鼠标点击?、HTML – 可能吗? – 一个div叠加层,它被鼠标事件完全忽略(这样鼠标事件只影响下面的div)、javascript – 将鼠标事件传播到模糊元素、macos – 将鼠标光标更改为不活动的NSWindow等相关知识的信息别忘了在本站进行查找喔。
本文标签: