} // MostrarTitulo().fim // [--- private void MostrarMouseInfo() { // Variáveis string para coletar informações do mouse string btn_info = null; string eixo_info = null; // Verifica o estado do mouse DirectInput.MouseState estadoMouse = mouse.CurrentMouseState; // Obtém e mostra informação sobre os eixos do mouse eixo_info = string.Format("X:{0} Y:{1} Z:{2}\r\n", estadoMouse.X, estadoMouse.Y, estadoMouse.Z); dxfMensagem.DrawText(null, eixo_info, new Rectangle(20, 70, 0, 0), DrawTextFormat.NoClip, Color.Blue); // Obtém e mostra estado dos botões byte[] buttons = estadoMouse.GetMouseButtons(); btn_info += string.Format(" Btn[0]:{0} ", buttons[0].ToString()); btn_info += string.Format(" Btn[1]:{0} ", buttons[1].ToString()); btn_info += string.Format(" Btn[2]:{0} ", buttons[2].ToString()); dxfMensagem.DrawText(null, btn_info, new Rectangle(120, 70, 0, 0), DrawTextFormat.NoClip, Color.Blue); } // MostrarMouseInfo().fim
public void UpdateMouse() { if (mouse != null) { try { DirectInput.MouseState state = mouse.CurrentMouseState; MouseX = state.X; MouseY = state.Y; byte[] buttons = state.GetMouseButtons(); MouseLeftButtonDown = buttons[0] > 0; //state.IsPressed(0); MouseRightButtonDown = buttons[1] > 0; //state.IsPressed(1); } catch (System.Exception e) { ziggyWin.EnableMouse(false); } } }
private ButtonState SetButtonState() { mouseState = MouseDevice.CurrentMouseState; if (!this.Enable) { return ButtonState.Disable; } // // Check mouse position on button place for // fine MouseOver or MouseDown else if (((mouseLocation.X >= this.Location.X) && (mouseLocation.X <= this.Location.X + this.size.Width)) && ((mouseLocation.Y >= this.Location.Y) && (mouseLocation.Y <= this.Location.Y + this.size.Height))) { // // MouseDown state if (mouseState.GetMouseButtons()[0] > 0) { return ButtonState.MouseDown; } // // MoseOver state else { // // mouse click on button event is handled if (state == ButtonState.MouseDown) SplashButton_Click(); return ButtonState.MouseOver; } } // // Normal state else { return ButtonState.Normal; } }