private void MyDataInfo_MouseUp(object sender, MouseEventArgs e) { //this.Cursor = Form1.MyCursor.Default; MouseDown_Flag = false; if (MouseFlag == MyMouse.RightFlag1) { contextMenuStrip1.Show(Control.MousePosition.X, Control.MousePosition.Y); } MouseFlag = MyMouse.None; }
public PDGame() { player1 = new PDPaddle("player1", "w", "s"); player2 = new PDPaddle("player2", "up", "down"); ResetPaddles(); ball = new PDBall(); ResetBall(); mouse = new MyMouse(); Futile.stage.AddChild(player1); Futile.stage.AddChild(player2); Futile.stage.AddChild(ball); }
private void MyDataInfo_MouseDown(object sender, MouseEventArgs e) { this.Focus(); MouseDown_Flag = true; Rectangle rect1 = new Rectangle(360, LcrEye_y, 25, (int)((float)this.Height * 12 / 70)); Rectangle rect2 = new Rectangle(660, ParEye_y, 25, (int)((float)this.Height * (Par_Num > 12 ? 12 : Par_Num) / Par_Num)); Rectangle rect3 = new Rectangle(967, ConstEye_y, 25, (int)((float)this.Height * (Const_Num > 12 ? 12 : Const_Num) / Const_Num)); Rectangle rect4 = new Rectangle(700, 30, 260, this.Height - 30); Rectangle rect5 = new Rectangle(0, 30, 260, this.Height - 30); if (e.Button == MouseButtons.Left) { if (rect1.Contains(e.Location))//滚动条 { //this.Cursor = Form1.MyCursor.Hand; MouseFlag = MyMouse.LeftFlag1; //滚动条1 this.mousePosition.X = e.X; // Control.MousePosition.X - this.Location.X; this.mousePosition.Y = e.Y; // Control.MousePosition.Y - this.Location.Y; tmp_eye_y = LcrEye_y; } if (rect2.Contains(e.Location))//滚动条 { //this.Cursor = Form1.MyCursor.Hand; MouseFlag = MyMouse.LeftFlag2; //滚动条2 this.mousePosition.X = e.X; // Control.MousePosition.X - this.Location.X; this.mousePosition.Y = e.Y; // Control.MousePosition.Y - this.Location.Y; tmp_eye_y = ParEye_y; } if (rect3.Contains(e.Location))//滚动条 { //this.Cursor = Form1.MyCursor.Hand; MouseFlag = MyMouse.LeftFlag3; //滚动条3 this.mousePosition.X = e.X; // Control.MousePosition.X - this.Location.X; this.mousePosition.Y = e.Y; // Control.MousePosition.Y - this.Location.Y; tmp_eye_y = ConstEye_y; } glfouse = false; constdatatabnum = 0; if (rect4.Contains(e.Location)) { for (int i = 0; i < ConstParRect.Count; i++) { if (ConstParRect[i].Contains(e.Location)) { constdatatabnum = i; SendData = DataConstValue[i].Value; glfouse = true; } } } UpDataInfoFrom.UDDrawConstChooseList = true; this.MyInvalidate(); } else if (e.Button == MouseButtons.Right) { if (rect5.Contains(e.Location)) { MouseFlag = MyMouse.RightFlag1; } } }