示例#1
0
        public MainForm()
        {
            Properties.Settings.Default.Upgrade();

            mouseHook = new MouseHookTrackballScroll();

            itemEnabled = new MenuItem(Properties.Resources.TextButtonHookEnabled, OnToggleHook)
            {
                Checked = true
            };

            var useX1 = Properties.Settings.Default.useX1;

            itemUseX1         = new MenuItem(Properties.Resources.TextButtonHookUseX1, OnToggleUseX1);
            itemUseX1.Checked = useX1;
            mouseHook.useX1   = useX1;

            var useX2 = Properties.Settings.Default.useX2;

            itemUseX2         = new MenuItem(Properties.Resources.TextButtonHookUseX2, OnToggleUseX2);
            itemUseX2.Checked = useX2;
            mouseHook.useX2   = useX2;

            var preferAxis = Properties.Settings.Default.preferAxis;

            itemPreferAxis               = new MenuItem(Properties.Resources.TextButtonPreferAxisEnabled, OnToggleAxis);
            itemPreferAxis.Checked       = preferAxis;
            mouseHook.preferAxisMovement = preferAxis;

            var useMiddleButton = Properties.Settings.Default.emulateMiddleButton;

            itemEmulateMiddleButton         = new MenuItem(Properties.Resources.TextButtonEmulateMiddleButton, OnToggleEmulateMiddleButton);
            itemEmulateMiddleButton.Checked = useMiddleButton;
            mouseHook.emulateMiddleButton   = useMiddleButton;

            ContextMenu trayMenu = new ContextMenu();

            trayMenu.MenuItems.Add(itemEnabled);
            trayMenu.MenuItems.Add(itemUseX1);
            trayMenu.MenuItems.Add(itemUseX2);
            trayMenu.MenuItems.Add(itemPreferAxis);
            trayMenu.MenuItems.Add(itemEmulateMiddleButton);
            trayMenu.MenuItems.Add(Properties.Resources.TextButtonAbout, OnAbout);
            trayMenu.MenuItems.Add(Properties.Resources.TextButtonExit, OnExit);

            trayIcon = new NotifyIcon
            {
                Text        = Properties.Resources.TextTitle,
                Icon        = Properties.Resources.icon,
                ContextMenu = trayMenu,
                Visible     = true
            };
        }
示例#2
0
        public MainForm()
        {
            mouseHook = new MouseHookTrackballScroll();

            itemEnabled         = new MenuItem(Properties.Resources.TextButtonHookEnabled, OnToggleHook);
            itemEnabled.Checked = true;

            itemPreferAxis               = new MenuItem(Properties.Resources.TextButtonPreferAxisEnabled, OnToggleAxis);
            itemPreferAxis.Checked       = true;
            mouseHook.preferAxisMovement = true;

            ContextMenu trayMenu = new ContextMenu();

            trayMenu.MenuItems.Add(itemEnabled);
            trayMenu.MenuItems.Add(itemPreferAxis);
            trayMenu.MenuItems.Add(Properties.Resources.TextButtonAbout, OnAbout);
            trayMenu.MenuItems.Add(Properties.Resources.TextButtonExit, OnExit);

            trayIcon             = new NotifyIcon();
            trayIcon.Text        = Properties.Resources.TextTitle;
            trayIcon.Icon        = Properties.Resources.icon;
            trayIcon.ContextMenu = trayMenu;
            trayIcon.Visible     = true;
        }
示例#3
0
        public MainForm()
        {
            Properties.Settings.Default.Upgrade();

            var queue = new ConcurrentQueue <MouseEvent>();

            mouseHook            = new MouseHookTrackballScroll(queue);
            mouseEventDispatcher = new MouseEventDispatcher(queue);

            itemEnabled = new MenuItem(Properties.Resources.TextButtonHookEnabled, OnToggleHook)
            {
                Checked = true
            };

            var useX1 = Properties.Settings.Default.useX1;

            itemUseX1         = new MenuItem(Properties.Resources.TextButtonHookUseX1, OnToggleUseX1);
            itemUseX1.Checked = useX1;

            var useX2 = Properties.Settings.Default.useX2;

            itemUseX2         = new MenuItem(Properties.Resources.TextButtonHookUseX2, OnToggleUseX2);
            itemUseX2.Checked = useX2;

            var preferAxis = Properties.Settings.Default.preferAxis;

            itemPreferAxis         = new MenuItem(Properties.Resources.TextButtonPreferAxisEnabled, OnToggleAxis);
            itemPreferAxis.Checked = preferAxis;

            var useMiddleButton = Properties.Settings.Default.emulateMiddleButton;

            itemEmulateMiddleButton         = new MenuItem(Properties.Resources.TextButtonEmulateMiddleButton, OnToggleEmulateMiddleButton);
            itemEmulateMiddleButton.Checked = useMiddleButton;

            var reverseVerticalScroll = Properties.Settings.Default.reverseVerticalScroll;

            itemReverseVerticalScroll         = new MenuItem(Properties.Resources.TextButtonReverseVerticalScroll, OnToogleReverseVerticalScroll);
            itemReverseVerticalScroll.Checked = reverseVerticalScroll;

            var reverseHorizontalScroll = Properties.Settings.Default.reverseHorizontalScroll;

            itemReverseHorizontalScroll         = new MenuItem(Properties.Resources.TextButtonReverseHorizontalScroll, OnToogleReverseHorizontalScroll);
            itemReverseHorizontalScroll.Checked = reverseHorizontalScroll;

            ContextMenu trayMenu = new ContextMenu();

            trayMenu.MenuItems.Add(itemEnabled);
            trayMenu.MenuItems.Add(itemUseX1);
            trayMenu.MenuItems.Add(itemUseX2);
            trayMenu.MenuItems.Add(itemPreferAxis);
            trayMenu.MenuItems.Add(itemEmulateMiddleButton);
            trayMenu.MenuItems.Add(itemReverseVerticalScroll);
            trayMenu.MenuItems.Add(itemReverseHorizontalScroll);
            trayMenu.MenuItems.Add(Properties.Resources.TextButtonAbout, OnAbout);
            trayMenu.MenuItems.Add(Properties.Resources.TextButtonExit, OnExit);

            trayIcon = new NotifyIcon
            {
                Text        = Properties.Resources.TextTitle,
                Icon        = Properties.Resources.icon,
                ContextMenu = trayMenu,
                Visible     = true
            };
        }