示例#1
0
        public KeyboardForm()
        {
            FormToolTip = new ToolTip();

            InitializeComponent();
            FormsManager.RegisterMainForm(this);

           if (DpiInfo.Dpi < 96)
            {
                menu.Height = (int) (menu.Height*(96F/DpiInfo.Dpi));
                    // Menu will always show even is fonts are set to less than 100%
            }
            else if (DpiInfo.Dpi > 96)
            {
                menu.Height = (int) (menu.Height*(DpiInfo.Dpi/96F));
            }

            LoadUserSettings();

            ResizeToAspect();

            if (DpiInfo.Dpi != 96)
            {
                PositionKeyboardCombo();
            }

            // This needs to be done after location and size of this form are fully determined.
            FormsManager.OpenChildForms();

            _lastSize = Size;

            GetKeyboardData();

            // Create event handlers 
            this.ResizeEnd += this.KeyboardFormResizeEnd;
            this.KeyboardListCombo.SelectedIndexChanged += KeyboardListSelectedIndexChanged;

            MappingsManager.MappingsChanged += OnMappingsChanged;
            UserColourSettingManager.ColoursChanged += OnColoursChanged;

            // Sniff for Caps/Num/Scroll lock keys being pressed while app doesn't have focus
            _sniffer = new KeySniffer();
            _sniffer.KeyPressed += ReceiveKeyPress;
            _sniffer.ActivateHook();

            this.Redraw();
        }
示例#2
0
 private void KeyboardFormClosed(object sender, FormClosedEventArgs e)
 {
     if (sniffer != null)
     {
         sniffer.KeyPressed -= ReceiveKeyPress;
         sniffer.DeactivateHook();
         sniffer = null;
     }
     KeyboardHelper.UnloadLayout();
 }
示例#3
0
        private void StartCapture()
        {
            if (sniffer == null)
            {
                sniffer = new KeySniffer(true);
                sniffer.KeyPressed += OnKeyPress;
            }

            sniffer.ActivateHook();
        }
示例#4
0
		private void StartCapture()
		{

			if (this._sniffer == null)
			{
				this._sniffer = new KeySniffer(true);
				this._sniffer.KeyPressed += OnKeyPress;
			}

			this._sniffer.ActivateHook();

		}