private QRect TargetRect() { QRect result = new QRect(0, 0, 20, 10); result.MoveCenter(new QPoint(target.X(), Height() - 1 - target.Y())); return(result); }
protected override void MouseMoveEvent(QMouseEvent e) { if (!barrelPressed) { return; } QPoint pos = e.Pos(); if (pos.X() <= 0) { pos.SetX(1); } if (pos.Y() >= Height()) { pos.SetY(Height() - 1); } double rad = Math.Atan(((double)Rect.Bottom() - pos.Y()) / pos.X()); SetAngle((int)Math.Round(rad * 180 / 3.14159265)); }