本文介绍了直接显示中的光标捕获的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我是新开发人员,想在Direct Show过滤器中捕获鼠标光标.
您可以帮忙吗?

Hello,
I''m new developer and want to capture mouse cursor in Direct Show filter.
can you help with this ?

推荐答案

using Microsoft.DirectX.DirectInput;





Device mouse;

void Initialize()
{

            mouse = new Device(SystemGuid.Mouse);
            mouse.SetCooperativeLevel(this,CooperativeLevelFlags.NonExclusive |CooperativeLevelFlags.Background );
            mouse.Acquire();
}

void RefreshMouse()
        {
//Call this method from some timer

            MouseState state = mouse.CurrentMouseState;
//Do something with it....
//Note: You get position of mouse from some reference and is of no use
//What is possible then? You can capture mouse button state and use native System.Windows.Forms.Cursor.Position to get the position of mouse
//To check Click on a panel use
if (state.GetMouseButtons()[0]!=0&& VideoPanel.Bounds.Contains(Cursor.Position))
                {
                    Media.FullScreen();
                }
}



谷歌,祝你好运! :)



Google it, Good luck ! :)


这篇关于直接显示中的光标捕获的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 06:00