locked
Multipoint mouse click on applications RRS feed

  • Question

  • Hello,

     

    I want to make the user able to to use multipoint mouse with any application. ( when a multipoint mouse click happens, the real cursor (not multipoint cursor, gets there to the position where it is clicked and click there )

    So since this feature is not  there in MPM SDK 1.5.1, so I thought of an alternative.

    What am trying to do is, I create a transparent window form, and i initialize it as multipoint window, but the missing part is the clicking. I don't know it neither moves the main cursor nor clicks.

     

    here is my code

    <Window x:Class="TransparentMouse.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:TransparentMouse"
        xmlns:mps="clr-namespace:Microsoft.Multipoint.Sdk.Controls;assembly=Microsoft.Multipoint.Sdk.Controls"
        Title="MainWindow" Height="350" Width="525" WindowState="Maximized" AllowsTransparency="True" Background="White" Opacity="0.1" WindowStyle="None" Loaded="Window_Loaded" WindowStartupLocation="CenterScreen">
      <Grid Name="MainGrid">
        <mps:MultipointButton Content="" Background="Transparent" MultipointClick="MultipointButton_MultipointClick" Click="MultipointButton_MultipointClick" Margin="0,-27,0,0"></mps:MultipointButton>
      </Grid>
    </Window>
    
    
    private void MultipointButton_MultipointClick(object sender, RoutedEventArgs e)
        {
          try
          {
            MultipointMouseEventArgs args = e as MultipointMouseEventArgs;
            DeviceInfo mouseObject = (DeviceInfo)args.DeviceInfo;
            MultipointMouseDevice mpDevice = (MultipointMouseDevice)mouseObject.DeviceVisual;
            System.Windows.Point MousePosition = mpDevice.Position;
            System.Windows.Point position = new System.Windows.Point();
            if (mpDevice != null)
              position = mpDevice.Position;
            
            //set the main cursor to multipoint mouse position
            //make it click at that position
            
          }
          catch (Exception)
          {
          }
        } 
    

     

    thanks in advance

    Sunday, January 30, 2011 1:19 PM